I need help with getting a script that will telnet to all telnet address's in the connection directroy and then send a few commands. Any help would be great.
The below link on my site is a script that will make a connection to all telnet entries in your Connection Directory, you'll just need to add the extra commands to it.
Thanks alot it works great. I already have another question now. In my waitfor statement the line I have to wait for looks like this "RR314.008.01 SID-54>", this is the command promt. I tried just using the ">" but it didn't work for me, any ideas how I can get the script to send my next command ?
Is that prompt constant or do parts of it change from time to time? I would make the waitfor more than just ">" if you can since that could be part of an escape sequence that you don't see but Procomm will key off of. Just a few unique characters would be enough.
Everything up to the ">" will change for each peice of equipment. Should it have worked just using the ">", if so this is what I used waitfor ">", is that not correct ?
It should have worked with waitfor ">" with one caveat. Since it's just a one character string, it's possible it could be matching on a ">" that is not associated with the prompt. What you can try doing is adding a statmsg or usermsg command that displays a message when the waitfor triggers to see when the data is coming in.
One other thing to be aware of is that a waitfor command times out after 30 seconds, so it's possible the script is proceeding even though the ">" character has not been received. You can change this behavior by adding the FOREVER keyword at the end of the waitfor command.
Ok, I re-entered the line and it worked..not sure what I did wrong the first time, but thanks you. I have another question for somebody. I have seprate folders with different types of equipment in each which take different types of commands, can I specify which folder to dial out of ?
Yes, for all the dial commands, you can add GROUP "groupname" after the TELNET keyword, where groupname is the name of the group exactly as it appears in the Connection Directory.
Ok, thanks but I must be on the slow side here because I can't get it to work. Could you give me an example of it, it sounds pretty stright forward, but its not working for me. Do I use it with the scrip you told me about for dialing the connection directory or is this a whole different script.
ok I changed it and I'm getting no complier error's, but the script seems to be doing nothing. It never telnets to the equipment, what do you see wrong with it..
proc main
integer iEntries ;Number of entries in dialing class
integer iCount ;Loop variable
string sName ;Name of Connection Directory entry
set capture file "Nav Alarm List.txt" ;sets caputure file to the file named in file_date proc
capture on ;turns on capture
dialcount TELNET GROUP "LA_NAVS" iEntries ;Get number of entries in specified dialclass
for iCount = 0 upto (iEntries - 1)
dialname TELNET GROUP "LA_NAVS" iCount sName ;Get entry name corresponding to index number
statmsg sName
dial TELNET GROUP "LA_NAVS" sName ;Make telnet connection
while $DIALING ;Loop while making connection
yield
endwhile
pause 1
if $CARRIER == 1 ;If connected
For testing purposes, change the statmsg sName command to usermsg sName. This will cause the name of the entry about to be dialed to appear in a popup. This will let us know if the script is at least getting that information from the Connection Directory.
ok it half way works, I changed the statmsg to usermsg and it shows me the correct name of the next equipment it should go to, but the script is telneting to the same box everytime...any idea's ????
I just checked a little farther and my problem started when trying to only dial the group I created. Here is the script, do you see anything wrong with it.
proc main
integer iEntries ;Number of entries in dialing class
integer iCount ;Loop variable
string sName ;Name of Connection Directory entry
dialcount TELNET GROUP "LA_NAVS" iEntries ;Get number of entries in specified dialclass
for iCount = 0 upto (iEntries - 1)
dialname TELNET GROUP "LA_NAVS" iCount sName ;Get entry name corresponding to index number
statmsg sName
dial TELNET GROUP "LA_NAVS" sName ;Make telnet connection
while $DIALING ;Loop while making connection
yield
endwhile
pause 1
if $CARRIER == 1 ;If connected
;do commands here
transmit "^M"
transmit "^M"
waitfor " Login:"
transmit "***^M"
waitfor " Password"
transmit "***^M"
waitfor ">"
transmit "alarms^M"
waitfor ">"
transmit "exit^M"
OK, took a little bit of digging, but found the problem. Drop GROUP "LA_NAVS" from the dial command. What was happening is that the script was trying to dial the group, which would always be the first entry in that group over and over, instead of the selected entry from that group.
Knob, does procomm have a hard time with telneting to a port number. I have modifed the script to telnet to a port to send TL-1 commands and now the script will not close the capture file, I also noticed that in the TL-1 I don't see what the script is transmitting, is that normal also. It appears that the script does finish running thou, just never closes the capture file.
Not that I'm aware of, are you specifying the number in the Connection Directory entry I presume?
Most likely, the remote system is not echoing what the script sends to it. You can select the Options | Data Options | Advanced menu item and change the duplex option on the right from full to half to have Procomm show what it is sending without relying on the other side to echo.
Still have not gotten the telneting with a port to work correctly yet, but still messing with it. My next question is can I use the " inside a line that I'm sending here's an example.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.