Jump to content

The obvious escapes me


Recommended Posts

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

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

I 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

Sorry, doesn't work; doesn't even bring the target into focus i.e. change the grayed out border of Screamer to blue. - Mike

Well 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

Well, that sure worked!

Thanks - Mike

You 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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...