Hello,
I want to configure a lot of telnet sessions, but I want to read IP adresses from file, so it will be easier to modify in future, dont need to compile every time if I will change something. Is it possible? Thanks.
Telnet IP from file
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Telnet IP from file
Yes, use ReadFile, or ReadLN or ReadIniFile functions.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Telnet IP from file
Thank youMarcus Tettmar wrote:Yes, use ReadFile, or ReadLN or ReadIniFile functions.

Re: Telnet IP from file
Now I have other problem. In txt file I have 3 lines with IP, if I run my code i get only second line ip backuped up, if I use debug to check everything step by step all 3 IP is backuped.
Code: Select all
Let>k=1
While>line<>##EOF##
ReadLn>C:\temp\ip.txt,k,line
If>ipas<>##EOF##
TelnetConnect>line,23,hTN
TelnetWaitFor>hTN,login,5,r
TelnetSend>hTN,admin%CR%
TelnetWaitFor>hTN,password,5,r
TelnetSend>hTN,pass%CR%
TelnetWaitFor>hTN,>,5,r
TelnetSend>hTN,_cmdline-mode on%CR%
TelnetWaitFor>hTN,],5,r
TelnetSend>hTN,Y%CR%
TelnetWaitFor>hTN,password,5,r
TelnetSend>hTN,512900%CR%
TelnetWaitFor>hTN,>,5,r
TelnetSend>hTN,tftp tftp_ip put startup.cfg /tftpboot/Config_%line%.cfg%CR%
TelnetClose>hTN
Endif
Let>k=k+1
EndWhile
Exit>0
- CyberCitizen
- Automation Wizard
- Posts: 724
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Re: Telnet IP from file
What about a telnet wait command after sending that last line with the .cfg in it. Could that be taking longer to process before your closing the connection? Can you add a brief wait line at the end before continuing?
Very hard to see what's occurring / test without the servers etc.
If it works though the debugger stepping through, then it's usually an issue with timing.
Very hard to see what's occurring / test without the servers etc.
If it works though the debugger stepping through, then it's usually an issue with timing.
FIREFIGHTER