How to automatically restart a program when it's closed?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
utz
Newbie
Posts: 18
Joined: Sat Aug 11, 2007 8:33 pm

How to automatically restart a program when it's closed?

Post by utz » Tue May 05, 2009 5:45 am

Hi there everyone,

I'm setting up a kiosk using the Opera browser. I've written a one-line MS script that launches it with the correct parameters (which allows me to run it in full-screen "kiosk mode"). Insofar as possible, I want to prevent a user from simply closing Opera with alt-F4 -- most of the other keyboard shortcuts are disabled by Opera when running in kiosk mode.

I've tried to extend my launch macro to run in a loop and detect specific keypresses that I want to suppress, but I don't really know if that's possible using MS.

If I can't stop the user from closing Opera, I was hoping I could get MS to monitor the status of that window and restart it if it were closed, but I couldn't get this to work either. Does anyone have any thoughts about if what I want to do is even possible?

Thanks,
Utz

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue May 05, 2009 7:02 am

Create a looping macro which uses IfWindowOpen to see if the Opera window is open AND/OR looks to see if an instance of opera.exe exists in the process list. If not, restart your main macro, continue looping.

For an IsProcessRunning function see:
http://www.mjtnet.com/forum/viewtopic.php?t=1652
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

utz
Newbie
Posts: 18
Joined: Sat Aug 11, 2007 8:33 pm

Post by utz » Tue May 05, 2009 7:23 am

Wow, that's perfect! I'm always amazed at your speed and that you always seem to have thought of the answer ahead of time. Amazing service and product, thanks again!

Utz

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts