Was wondering if anyone here could help out..
Im trying to get the script to read from one file named host.txt then while NOT feof run a function called TSERVER which goes and reads another file called TSERVER.txt. The problem is that when it finishes reading the Tsrever file it goes bacm to proc main thinking that the file is now eof for host.txt ...
The script I made below...
Can anyone help ou please ..Im going mad..
************************************************
proc main
string Fname = "host.txt" ;name cannot be altered
string Fname2 = "tserver.txt" ;name cannot be altered
string linebuffer
string CapName = "Applications.cap"
string linestring
usermsg linestring
if fopen 0 Fname READ TEXT ;open file for read only
fseek 0 0 1
while not feof 0 ;loop while not end of file
fgets 1 LineString
fgets 0 linebuffer ;get host name from file
pause 2
dial TELNET linebuffer ;establish telnet session
while $dialing ;loop while establishing telnet session
endwhile
if $carrier ;if session established
waitfor "login: " forever ;login section
transmit "genesys^m" ;transmitting LOGON
waitfor "password: " forever
transmit "genelabs^m" ;transmitting PASSWORD
usermsg "about to run TSERVER FUNCTION"
pause 1
Call TSERVER
usermsg "ran TSERVER FUNCTION"
usermsg linebuffer
pause 1
transmit "exit^m"
pause 1
else
errormsg "Connection Not Establised To %s." linebuffer
endif
endwhile
else
errormsg "File Not Found"
endif
capture off
endproc
func TSERVER : string ; Must include return type!
string Fname = "host.txt"
string fname2 = "tserver.txt"
string sztext
string CapName = "Applications.cap"
fopen 0 fname2 READ TEXT
while not feof 0
set capture file CapName ; Set name of capture file.
capture on ; Open up the capture file.
fgets 0 sztext
transmit "cd^m"
transmit "cd logs^m"
pause 1
transmit "ls -lrt *"
transmit sztext
transmit "*^m"
pause 2
endwhile
return fname2
Im trying to get the script to read from one file named host.txt then while NOT feof run a function called TSERVER which goes and reads another file called TSERVER.txt. The problem is that when it finishes reading the Tsrever file it goes bacm to proc main thinking that the file is now eof for host.txt ...
The script I made below...
Can anyone help ou please ..Im going mad..
************************************************
proc main
string Fname = "host.txt" ;name cannot be altered
string Fname2 = "tserver.txt" ;name cannot be altered
string linebuffer
string CapName = "Applications.cap"
string linestring
usermsg linestring
if fopen 0 Fname READ TEXT ;open file for read only
fseek 0 0 1
while not feof 0 ;loop while not end of file
fgets 1 LineString
fgets 0 linebuffer ;get host name from file
pause 2
dial TELNET linebuffer ;establish telnet session
while $dialing ;loop while establishing telnet session
endwhile
if $carrier ;if session established
waitfor "login: " forever ;login section
transmit "genesys^m" ;transmitting LOGON
waitfor "password: " forever
transmit "genelabs^m" ;transmitting PASSWORD
usermsg "about to run TSERVER FUNCTION"
pause 1
Call TSERVER
usermsg "ran TSERVER FUNCTION"
usermsg linebuffer
pause 1
transmit "exit^m"
pause 1
else
errormsg "Connection Not Establised To %s." linebuffer
endif
endwhile
else
errormsg "File Not Found"
endif
capture off
endproc
func TSERVER : string ; Must include return type!
string Fname = "host.txt"
string fname2 = "tserver.txt"
string sztext
string CapName = "Applications.cap"
fopen 0 fname2 READ TEXT
while not feof 0
set capture file CapName ; Set name of capture file.
capture on ; Open up the capture file.
fgets 0 sztext
transmit "cd^m"
transmit "cd logs^m"
pause 1
transmit "ls -lrt *"
transmit sztext
transmit "*^m"
pause 2
endwhile
return fname2