ptclarke Posted July 12, 2013 Share Posted July 12, 2013 I am new to autoit and trying to figure things out. My first script is pretty basic and is designed automate the steps to get connected to my employer's VPN. Rough description: Start the RSA SecureID application Paste my PIN Copy the token to the clipboard Close the RSA app. Run the Nortel VPN Client Paste the token in there "Hit" Enter Everything works great. However somewhere around 3 to 5 minutes later the RSA app pops up again on the desktop. Any clues as to what might be happening? Here is the the script: #include <Clipboard.au3> #include <GuiEdit.au3> $yesno = MsgBox( 36, "VPN Apps", "Connect to VPN?" ) If $yesno = "6" Then ; Yes button was clicked Run("C:Program FilesRSA SecurID Software TokenSecurID.exe") WinWaitActive("000127560000 - RSA SecurID Token") Send("1234") Sleep( 100 ) Send("{ENTER}") Sleep( 100 ) Send("{CTRLDOWN}c{CTRLUP}") WinClose("000127560000 - RSA SecurID Token") Run("C:Program FilesNortelNortel VPN ClientNvc.exe") ; wait 10 seconds for the NVC GUI to appear. If it doesn't, it probably means you are already connected and the Status GUI has popped up $retcode1 = WinWaitActive("Nortel VPN Client", "" , 10 ) If $retcode1 <> 0 Then Send("{CTRLDOWN}v{CTRLUP}") Sleep( 100 ) Send("{ENTER}") _ClipBoard_Open(0) _ClipBoard_Empty() _ClipBoard_Close() Else Exit EndIf $retcode2 = WinWaitActive("Security Banner", "" , 60 ) If $retcode2 <> 0 Then Send("{ENTER}") Else Exit EndIf EndIf Exit Link to comment Share on other sites More sharing options...
0xdefea7 Posted July 12, 2013 Share Posted July 12, 2013 (edited) For one, you can use ClipPut and ClipGet for the clipboard stuff. (instead of sending Ctrl + C) Like you said, the script only starts the program for you, if everything works as far as getting you connected initially to the VPN, then the glitch is on the Nortel software side I would imagine. I did a quick Google but didn't come up with anything specific about issues with Nortel. That is where I would be looking. Your script exits once the application is run so it is not possible that the script is the issue. Edited July 12, 2013 by 0xdefea7 Link to comment Share on other sites More sharing options...
ptclarke Posted July 12, 2013 Author Share Posted July 12, 2013 Thanks for the ClipPut and ClipGet tip, 0xdefea7 I get what you are saying about this issue not being with the script, but this doesn't happen when I run the two apps manually. Curious. Cheers Link to comment Share on other sites More sharing options...
0xdefea7 Posted July 12, 2013 Share Posted July 12, 2013 That is curious. Here is a SO thread about someone using a script and it seems that they are not facing the same issue, but this might put you on the right track: http://stackoverflow.com/questions/13628517/is-it-possible-to-write-a-script-to-avoid-vpn-from-getting-timeout Link to comment Share on other sites More sharing options...
ptclarke Posted July 12, 2013 Author Share Posted July 12, 2013 Thanks again, but that has nothing to do with my issue. Perhaps you misunderstood my problem. It is the RSA token app that pops up again, not the Nortel VPN client. Anyway no big deal. I was just using this script as an AutoIt intro for myself. I am not under any pressure to produce a working tool for others to use. Link to comment Share on other sites More sharing options...
Solution ptclarke Posted July 13, 2013 Author Solution Share Posted July 13, 2013 Mystery solved. Although I was doing a WinClose for the RSA token, the process was staying active. I added ProcessClose ( "SecurID.exe" ) after the WinClose line and everything is fine now. 0xdefea7 1 Link to comment Share on other sites More sharing options...
0xdefea7 Posted July 13, 2013 Share Posted July 13, 2013 Thanks for sharing that answer Glad that you got it solved. Link to comment Share on other sites More sharing options...
Celtic88 Posted July 13, 2013 Share Posted July 13, 2013 (edited) SELFREST() FUNC SELFREST() SHELLEXECUTE(@AUTOITEXE, '/AUTOIT3EXECUTELINE "IF PROCESSWAITCLOSE(' & @AUTOITPID & ') THEN SHELLEXECUTE(''' & @SCRIPTFULLPATH & ''')"') EXIT ENDFUNC Edited July 13, 2013 by Mrbenkali Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now