Can Sikuli detect whether or not an app is running?

Asked by Raiden on 2010-02-03

I was wondering if Sikuli can detect whether or not an app was running, even if that app is not using a window. I am trying to create a script that, when I launch one of my emulators (DOSBox for example), the script would change some settings in System Preferences. The script would basically start when I log in and loop, changing settings when an emulator is started, and changing them back when the emulator is closed. However, the script shouldn't change anything unless an emulator is started or stopped, so that is why I need the script to be able to know if an app is running. For reference I'm running Mac OS X 10.6.2 on an early 2009 iMac 24" 3.06GHz 4GB RAM 1TB HDD

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2010-02-03
Last reply:
2010-02-04
Sergey Darovskih (darovskih) said : #1

I don't know about macs, but in Windows you can run BAT file which will detect whether the process is running. Or you can start Task Manager, open "processes" and try to find text "dosbox.exe" there. If it may help, I can explain this in more details.

Andy.G (agibel07) said : #2

I don't think you can really do what you want to unless you script a process check like Sergey suggests (which would be kind of a pain). The only methods dealing with apps are openApp(), closeApp(), and switchApp(). Since switch app launches the application with openApp() if the argument is not running, you cant do a check first. Obviously the functionality is there since switchApp() is at some point finding out the information you need but the API is not there for pulling it out to use yet.

I would suggest making a script to check/grep processes and then just launch your Sikuli script from there.

Can you help with this problem?

Provide an answer of your own, or ask Raiden for more information if necessary.

To post a message you must log in.