Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TELNET Automation Question

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Help,
I am trying to write a script to log into a Siemens HiPath system. Normally I use RASPHONE.EXE to connect. I would like to be able to accomplish the Following:
1. Start RASPHONE.exe
2. Create a New connection
3. Establish the new Connection.
4. Once the Connection is established I want to run a script.
5. The script files work its just items 1 thru 4 I am having difficulty with.

I can start RASPHONE.exe, hoever it does NOT maintain the Focus. In addition I need to pass the Focus back to ProComm to continue with script execution after the PPP connection is established.

does anyone have any ideas?
here are the Login script files I have for now.



#define sComputerSetUp "\\rmss0020\FTPStuff\RH_Pro.exe"
#define WorkDir "C:\Program Files\Symantec\ProComm Plus\aspect\"
Proc main
integer Event
string Prog ="C:\WINNT\System32\RASPHONE.exe" ; Program to execute.
; run Prog ; Execute the Windows RASPHONE program.

dialogbox 0 187 43 274 135 2 " Are Login and Password Generic (engr, xxx.xxx)?"
pushbutton 1 82 13 100 24 "YES"
pushbutton 2 82 45 100 24 "NO"
pushbutton 3 107 84 50 28 "Exit" CANCEL
enddialog
while 1
dlgevent 0 Event
switch Event
case 0
endcase
case 1
chdir WorkDir
isfile "HiPath 4000 Default Login.wax" ; Verifies that File does Exist.
if SUCCESS
execute "HiPath 4000 Default Login.wax"
disable DLGCTRL 0 1
else
usermsg "Access NOT Authorized!! See Your System Administrator"
exit
endif
endcase
case 2
chdir WorkDir
isfile "HiPath 4000 Other Login.wax" ; Verifies that File does Exist.
if SUCCESS
execute "HiPath 4000 Other Login.wax"
disable DLGCTRL 0 2
else
usermsg "Access NOT Authorized!! See Your System Administrator"
exit
endif
endcase
default
exitwhile
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL
endproc



proc main
string sUserId = "LOGIN"
string sPassword = "PASSWORD"
string sEnter = "^M"
string Hpk4Login = "Hp4k Login.txt"
string NormalCap = "OldCapture.cap"
string CapPath ="C:\Temp Data Files\Raw Data\"
string OldCapPath ="C:\Program Files\Symantec\Procomm Plus\Capture"
integer szSelect = 0
waitquiet 1
capture OFF
set capture path CapPath
set capture file Hpk4Login
set capture overwrite ON
set capture query OFF
capture ON
strcat sUserId sEnter
strcat sPassword sEnter
transmit "^M"
waitfor "login: "
transmit sUserId
waitfor "Password:"
transmit sPassword
waitfor "# "
transmit "/opt/mpcid/bin/dipas_batch^M"
waitfor " <"
endproc



proc main
string szLogin, szPassword
string sEnter = "^M"
string Hpk4Login = "Hp4k Login.txt"
string NormalCap = "OldCapture.cap"
string CapPath ="C:\Temp Data Files\Raw Data\"
string OldCapPath ="C:\Program Files\Symantec\Procomm Plus\Capture"
waitquiet 1
capture OFF
set capture path CapPath
set capture file Hpk4Login
set capture overwrite ON
set capture query OFF
capture ON
sdlginput "Enter the Login" "Enter the Login Name:" szLogin
sdlginput "Enter the Password" "Enter the Password:" szPassword
strcat szLogin sEnter
strcat szPassword sEnter
transmit "^M"
waitfor "login: "
transmit szLogin
waitfor "Password:"
transmit szPassword
waitfor "# "
transmit "/opt/mpcid/bin/dipas_batch^M"
waitfor " <"
endproc



Any and all assistance will be greatly appreciated.
 
I can't test this well at work, but you can use the winfocus command to set the focus back to rasphone.exe and also back to Procomm (using winfocus $PWMAINWIN in this case) later.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top