rjdegraff Posted September 8, 2005 Share Posted September 8, 2005 I have two apps that have to start automatically when the machine starts up (actually two instances of the same app with different parameters). I have a CMD file that runs the startup code in sequence. StartVista.cmd ----------------- cd "d:\vista\server import" cscript StartServer.vbs cd "d:\vista\server process" cscript StartServer.vbs The two vbScripts are identical except for the value of the variable "server". The first server instance always starts as expected, however, when the second instance starts up, the "Connection Dialog" window never gets activated. The window is displayed but it never gets focus. With the "Active Window Tool" running, even if I manually select the window, it still doesn't register as having focus. StartServer.vbs ------------------ server = "Import Vista Data" set wso = CreateObject("Wscript.Shell") set aut = CreateObject("AutoitX3.Control") wso.Run "..\exe\svr_app.exe",1,false title = "Connection Dialog" aut.Opt "WinTitleMatchMode",2 aut.WinWait title aut.WinActivate title aut.WinWaitActive title aut.ControlSetText title,"","4207","svr_app_admin" aut.ControlSetText title,"","4215","svr_app_admin" aut.ControlClick title,"OK","1" title = "Server Settings" aut.WinWait title aut.WinActivate title aut.WinWaitActive title aut.ControlClick title,"Manual","128" aut.Sleep 1000 aut.ControlClick title,"OK","1" aut.Sleep 2000 SetTitle "Operational Data Processor - Server - [status]",Server Function SetTitle ( currtitle , newtitle ) on error resume next wso.Run "cmdow.exe " & """" & currTitle & """" & " /REN """ & newtitle & """", 0, True if err.Number <> 0 then err.Clear End Function Link to comment Share on other sites More sharing options...
AutoChris Posted September 8, 2005 Share Posted September 8, 2005 I have two apps that have to start automatically when the machine starts up (actually two instances of the same app with different parameters). I have a CMD file that runs the startup code in sequence.StartVista.cmd-----------------cd "d:\vista\server import"cscript StartServer.vbscd "d:\vista\server process"cscript StartServer.vbsThe two vbScripts are identical except for the value of the variable "server". The first server instance always starts as expected, however, when the second instance starts up, the "Connection Dialog" window never gets activated. The window is displayed but it never gets focus. With the "Active Window Tool" running, even if I manually select the window, it still doesn't register as having focus.StartServer.vbs------------------server = "Import Vista Data"set wso = CreateObject("Wscript.Shell")set aut = CreateObject("AutoitX3.Control")wso.Run "..\exe\svr_app.exe",1,falsetitle = "Connection Dialog"aut.Opt "WinTitleMatchMode",2aut.WinWait titleaut.WinActivate titleaut.WinWaitActive titleaut.ControlSetText title,"","4207","svr_app_admin"aut.ControlSetText title,"","4215","svr_app_admin"aut.ControlClick title,"OK","1"title = "Server Settings"aut.WinWait titleaut.WinActivate titleaut.WinWaitActive titleaut.ControlClick title,"Manual","128"aut.Sleep 1000aut.ControlClick title,"OK","1"aut.Sleep 2000SetTitle "Operational Data Processor - Server - [status]",ServerFunction SetTitle ( currtitle , newtitle ) on error resume next wso.Run "cmdow.exe " & """" & currTitle & """" & " /REN """ & newtitle & """", 0, True if err.Number <> 0 then err.ClearEnd Function<{POST_SNAPBACK}>Methinks thou art posting on thy wrong forum!Try Experts Exchange for vbscript help. If you wanted to convert your vbscript into AutoIt, then you would have been in the right place. Link to comment Share on other sites More sharing options...
MHz Posted September 8, 2005 Share Posted September 8, 2005 Methinks thou art posting on thy wrong forum!Try Experts Exchange for vbscript help. If you wanted to convert your vbscript into AutoIt, then you would have been in the right place.<{POST_SNAPBACK}>It is AutoItX3. Correct website, only wrong subforum.@rjdegraffDouble check the case of the titles as AutoIt is case sensitve. It could be something simple. 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