Monday, March 1, 2021

#1 2011-09-02 10:14:18 am

T_Rex
Member
From:: Minneapolis
Registered: 2005-03-16
Posts: 49
Website

Trigger a script on waking from sleep

I have a script that will run a QuickTime movie after a computer starts (every day), but the constant shutting down/restarting has been enough of a shock to the system that it is occasionally corrupting the directories on the hard drive. So I would like to trigger the script to run upon the system waking from sleep.

Perhaps this is really simple, but I am stumped, seeing no command for waking in the dictionaries of the Finder/System Events, etc.

Any help would be greatly appreciated.


T_Rex


Filed under: , on waking Mac

Offline

 

#2 2011-09-03 04:00:34 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11739
Website

Re: Trigger a script on waking from sleep

Hi,

AppleScript is not able to respond to sleep/wake notifications,
you need something like Scenario


regards

Stefan

Offline

 

#3 2011-09-09 12:37:05 pm

T_Rex
Member
From:: Minneapolis
Registered: 2005-03-16
Posts: 49
Website

Re: Trigger a script on waking from sleep

Thanks for letting me know that.

Whatever happened to AppleScript's Launch Utility (I remember this little rocket icon a few versions of OS X back)?


T_Rex

Offline

 

#4 2011-09-09 07:10:40 pm

macman_al
Member
From:: Huntsville, AL USA
Registered: 2005-08-28
Posts: 71

Re: Trigger a script on waking from sleep

that is a simple problem to solve. 

You certainly must be having the computer wake up at a certain time everyday.  All you have to do is set an event in iCal to execute an AppleScript to run the Quicktime movie.  Have the event happen thirty seconds or so after your wake-up time.

Strange that you are having this system problem.  I have the same setup on two Mac minis for four years with no problems.  The Mac minis are connected to large screen LCD displays. 

I have the energy saver prefs to turn on the Mac mini every morning and then launches an AppleScript app as a login item.  The AppleScript first checks to see if it is Sunday, which if it is, shuts the computer down otherwise it opens the Quicktime document, goes full screen, then turns on looping.

At the end of the day at close of business an iCal event executes an AppleScript to quit Quicktime and shut the computer down.

This setup has run for four years now with no problem.  I don't think I've even run updates on the Mac minis.

Last edited by macman_al (2011-09-09 07:19:52 pm)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)