Jump to content
Sign in to follow this  
GreatBarrier86

Using EXE within runonce

Recommended Posts

Has anyone had this problem?

I've set the AutoIT program i've created to run in a runonce. The program begins running, but nothing happens until the mouse is moved.

Here is my code.

CODE
Dim $OSVersion

;Get OS version

$OSVersion = @OSVersion

if $OSVersion = "WIN_VISTA" Then

$OSVersion = "Vista"

Else

$OSVersion = "XP"

EndIf

If ($OSVersion = "XP") Then

;Run "Network Connections"

Run("Control ncpa.cpl")

;Wait for Network Connections window

;Send keys to activate File | New Connection Wizard

WinWaitActive("Network Connections")

Send("!FN")

;Wait for New Connection Wizard window

;Send keys to click Next button

WinWaitActive("New Connection Wizard", "Welcome to the New Connection Wizard")

Send("!N")

;Wait for Network Connection Type window

;Send keys to select VPN radio button

;Send keys to click Next button

WinWaitActive("New Connection Wizard", "C&onnect to the network at my workplace") ;this looks weird, but the AutoIT window info shows there being a & after the C and before the O

Send("!ON")

;Wait for Dial-Up\VPN Connection window

;Send keys to select VPN

;Send keys to click Next button

WinWaitActive("New Connection Wizard", "Create the following connection")

Send("!VN")

;Wait for Connection Name window

;Send keys to type "CIA VPN"

;Send keys to click Next button"

WinWaitActive("New Connection Wizard", "Company N&ame")

Send("!A")

Send("CIA VPN") ;Send "CIA VPN"

Send("!N") ;Click Next

;Wait for VPN Server Selection window

;Send keys to type "vpn.custard.com"

;Send keys to click Next button

WinWaitActive("New Connection Wizard", "&Host name or IP address (for example, microsoft.com or 157.54.0.1 ):")

Send("!H")

Send("myaddress")

Send("!N")

;Wait for Completing the New Connection Wizard screen

;Send keys to add shortcut to desktop

;Send keys to click Finish

WinWaitActive("New Connection Wizard", "Completing the New Connection Wizard")

Send("!S")

Send("{TAB}")

Send("{TAB}")

Send("{ENTER}")

;Wait for "Connect CIA" VPN screen

;Enter username and password

;Connect briefly to save credentials

WinWaitActive("Connect CIA VPN")

Send("!U")

Send("name")

Send("!P")

Send("Password")

Send("!S") ;Select and check Save info button

Send("!A") ;Select and check "Anyone"

Send("{ENTER}") ;connect

;Connect briefly then exit

WinWaitActive("Connecting CIA VPN...")

Send("{SPACE}")

EndIf

Edited by GreatBarrier86

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...