Damien56546 Posted November 26, 2008 Share Posted November 26, 2008 I am working on a PHP web app. Basically what I want is a script that will run in the background always, and when a certain page is loaded, it will execute keystrokes and load an application. This seems like an easy way as i've stuffed around with PHP execution to no avail. It's only for one PC anyway. This works: If WinWaitActive("Google - Mozilla Firefox") Then Send('#r') Send('cmd{ENTER}') EndIf But after CMD launches, the script terminates. I want it to be running in the background ready to do the same thing each time the page is loaded, is that possible? I've tried but I end up havign the cmd popup like 20 times at once. Thanks Link to comment Share on other sites More sharing options...
MilesAhead Posted November 26, 2008 Share Posted November 26, 2008 Depends if you need to do the action only once after the window exists, or each time it's the active window. Only you know exactly what you are doing. But I would suggest once you perform your action then using something like WinWaitNotActive, or if you don't want to do the action again until a new window with that title pops up, then wait as long as the window exists.. as in While WinExists sleep(250) until the window is closed.. then you wait for it to pop up again. 2 nested loops should do it. My Freeware Page Link to comment Share on other sites More sharing options...
Robjong Posted November 26, 2008 Share Posted November 26, 2008 hey, I think this should do the trick Global Const $sWinTitle = "Google - Mozilla Firefox" Global $bDone = 0 While 1 If Not $bDone And WinActive($sWinTitle) Then Send('#r') Send('cmd{ENTER}') $bDone = 1 ElseIf $bDone And Not WinExists($sWinTitle) Then $bDone = 0 EndIf Sleep(25) WEnd Link to comment Share on other sites More sharing options...
Damien56546 Posted November 26, 2008 Author Share Posted November 26, 2008 hey, I think this should do the trick Global Const $sWinTitle = "Google - Mozilla Firefox" Global $bDone = 0 While 1 If Not $bDone And WinActive($sWinTitle) Then Send('#r') Send('cmd{ENTER}') $bDone = 1 ElseIf $bDone And Not WinExists($sWinTitle) Then $bDone = 0 EndIf Sleep(25) WEnd Thanks to you both. This one works perfectly! Link to comment Share on other sites More sharing options...
Damien56546 Posted November 26, 2008 Author Share Posted November 26, 2008 Thanks to you both.This one works perfectly!Actually just one more thing,Is there a faster/more efficent way to launch applications within an AutoIt script?Start -> Run CMD is fine, but when the file paths start to get longer there's that lil' bit of lag/delay while it enters the keystrokes in and i'd rather not have it 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