Play a sound on an event?

Asked by Romulo on 2010-01-31

I have an internet connection that is not really reliable, so I have to check it from time to time, and restart the devices when it is offline. Sometimes I have to leave my room, but I am still able to hear the phone ringing on Skype if any of my contacts call me.
But the thing is sometimes when I'm not around the connection goes offline. So I was trying to figure out a way for Sikuli to watch my back by playing a warning sound, so I know that I have to go there and restart my connection.
I was able to find out how to show a popup telling me that there is no internet connection (wich, by the way is a simple task). But I didn't find any references to playing audio on the documentation. All I could find was a command to open an app, but I wasn't able to understand this command very well nor I do know if it has something to do with what I'm trying to do here.
So please someone help me with this task or tell me if it is not possible.
Thanks a lot.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Sergey Darovskih
Last query:
Last reply:
Best Sergey Darovskih (darovskih) said : #1


The simplest way to do that, I think, is to call a BAT file like this: openApp("c:\\1.bat"). Batch file contents, for example, should be:

"I:\Program Files\Windows Media Player\wmplayer.exe" c:\radiohead-creep.mp3

Romulo (romulopimentel) said : #2

Thank you, Sergey.
It worked like a charm.

I also use my computer for downloads over the night, so I just turn off the monitor. It happens sometimes that just some minutes after I go to sleep the connection is over. And the computer stays on, doing nothing (and wasting electricity).
With similar commands I'm also able to shutdown it as soon as the connection is over, saving energy this way.
Here is the way I did it:

while find ("the active connection icon on my taskbar"):
   sleep (10)

On this batch file I put the commands:

"C:\Windows\System32\shutdown.exe -s -t 00"

I'll test it tonight. ^^
Again, thanks a lot for the quick answer.

Romulo (romulopimentel) said : #3

Thanks Sergey Darovskih, that solved my question.