Script help [5]

Script help

Monday, February 22, 2016 11:04 AM - Simon

Dears,
I need to make script to open text file and read 1st line only and keep it in memory to reuse after. can you help me how knowing that I know the name of the file already.

Program Ver. : Xshell 5


Re: Script help

Wednesday, February 24, 2016 7:19 AM - Simon

any update please ?


Re: Script help

Thursday, February 25, 2016 8:43 PM - Support

Try this script below:

Sub Main()
Dim objFile, File, line
Dim objClip

'Read File
Set objFile = CreateObject("Scripting.FileSystemObject")
Set File = objFile.OpenTextFile("\your_path\your_file.vbs", 1)
line = File.Readline
File.Close

'Save ClipBoard
set objClip = CreateObject("htmlfile")
objClip.parentWindow.clipboardData.SetData "text", line

xsh.dialog.msgbox("'"&line&"' copied to the system clipboard")
End Sub

Technical Support

Like us on Facebook
Follow us on Twitter
Visit our blog Blog


Re: Script help

Sunday, February 28, 2016 10:22 AM - Simon

when i run the script I get error "file not found" while file in the dir

'Read File
Set objFile = CreateObject("Scripting.FileSystemObject")
Set File = objFile.OpenTextFile("filename.txt", 1)
line = File.Readline
File.Close

I need to check the file is Exists first too.
I run the script over AIX 7.1 from xshell

Thanks in advance for your support.


Re: Script help

Monday, February 29, 2016 10:58 PM - Support

The absolute path is required. That should resolve the error. Let me know if it works.

Technical Support

Like us on Facebook
Follow us on Twitter
Visit our blog Blog


Re: Script help

Tuesday, March 1, 2016 8:08 AM - Simon

Dears,
I used the full path with same error but when I changed the path to windows and try the code run with No problems so what i figure that VBS can't check the path over AIX or can't find it Kindly if you have any work around provide it to me Thanks i advance. waiting for your reply.


Previous views: 127