Mike Horowitz Posted March 18, 2007 Share Posted March 18, 2007 Over the last two months I"ve been trying to write a script to turn a recording application (Screamer Radio) on and off. Although the forum has stuck with me as I tried to get 'sleep' to work, then the coding of a loop which checks how much time has elapsed before continuing, neither attempt met with success (both would do OK until I recoded for a 2 hr delay at which point they would continue indefinitely). So, I settled on a program which started Screamer (which works fine) and a second script which should shut it off at a scheduled time; that time being set by MS's scheduler. So I wrote the following: WinActivate("Screamer Radio v0.3.8") ; this to give the window focus Sleep(5000) send ("!s") ; stop the recording, really unneeded send ("!f") ; pull down the File choices Sleep(3000) send("x") ; Exit Exit I tried this as a script and the window that got focus was the SCIte window; displayed its file menu just as if I had wanted it to. So, why didn't the Screamer window get the focus? - Mike Link to comment Share on other sites More sharing options...
Shevilie Posted March 18, 2007 Share Posted March 18, 2007 (edited) If WinExists("Screamer") Then WinClose("Screamer") MsgBox(0,0,"I found the window") EndIf Edited March 18, 2007 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Mike Horowitz Posted March 19, 2007 Author Share Posted March 19, 2007 If WinExists("Screamer") Then WinClose("Screamer") MsgBox(0,0,"I found the window")EndIfSorry, doesn't work; doesn't even bring the target into focus i.e. change the grayed out border of Screamer to blue. - Mike Link to comment Share on other sites More sharing options...
PaulIA Posted March 19, 2007 Share Posted March 19, 2007 Over the last two months I"ve been trying to write a script to turn a recording application (Screamer Radio) on and off. Although the forum has stuck with me as I tried to get 'sleep' to work, then the coding of a loop which checks how much time has elapsed before continuing, neither attempt met with success (both would do OK until I recoded for a 2 hr delay at which point they would continue indefinitely). So, I settled on a program which started Screamer (which works fine) and a second script which should shut it off at a scheduled time; that time being set by MS's scheduler. So I wrote the following: WinActivate("Screamer Radio v0.3.8") ; this to give the window focus Sleep(5000) send ("!s") ; stop the recording, really unneeded send ("!f") ; pull down the File choices Sleep(3000) send("x") ; Exit Exit I tried this as a script and the window that got focus was the SCIte window; displayed its file menu just as if I had wanted it to. So, why didn't the Screamer window get the focus? - MikeI downloaded Screamer, ran it and then ran your script and it works just fine as long as a song isn't playing. When a song is playing, Screamer's title changes to the song title, so WinActivate will always fail. If you want to kill Screamer, just execute: ProcessClose("screamer.exe") Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Shevilie Posted March 19, 2007 Share Posted March 19, 2007 Sorry, doesn't work; doesn't even bring the target into focus i.e. change the grayed out border of Screamer to blue. - MikeWell if theres no message box here - then the window is not found, try to use the Autoit Info Tool to see wht the title is Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Mike Horowitz Posted March 20, 2007 Author Share Posted March 20, 2007 If you want to kill Screamer, just execute: ProcessClose("screamer.exe") Well, that sure worked! Thanks - Mike Link to comment Share on other sites More sharing options...
PaulIA Posted March 20, 2007 Share Posted March 20, 2007 Well, that sure worked!Thanks - MikeYou could do it another way too. When you start Screamer, you know what the title is, so use WinGetHandle to get the window handle. You can then use the "ordinary" AutoIt commands to send commands to Screamer when songs are playing. Auto3Lib: A library of over 1200 functions for AutoIt 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