possible to turn on monitor from apple script?

Hello,

I am new to apple script, and have been trying to research a few things, but have been unable to find a decent answer.

I am trying to find out if it is possible to wake a monitor on an iMac(via an apple script), that has been put to sleep via power save in system preferences.

If that is not possible, is there some way to possibly mimic a mouse movement or keyboard input that will wake the monitor?

What I am trying to do basically is this:

I have an iPhone, and am using Air Cam app to stream live audio/video. I do not wish to leave the app running 24/7. I have gotten the app to launch with a simple e-mail script. The problem is that in energy saving preferences, I have the monitor set to shut off after 15 minutes. When the monitor is shut off, it will not display video in the Air Cam app for some reason.

If I remotely log in from the iPhone to the iMac and for instance move the mouse with RDP, the monitor comes on. I can then launch the Air Cam app, and all is well.

So basically I just need some mechanism that will wake the monitor. As I said, I have been looking, but do not even know if it is possible.

Any information is much appreciated. I am not necessarily looking for someone to write code for me, but rather give me a gentle push in the right direction! :wink:

Thanks again.

Hi renegad3,

You can wake up the screen by calling «UpdateSystemActivity(0)», a function of the Power Manager from the CoreServices framework.

I have written and compiled a small foundation tool for you, which can be executed with the «do shell script» command from AppleScript. You can download the tool here. Just unzip it and make sure to include the appropriate path in the AppleScript code below. If you are interested in the most simple source code, then point your browser to this URL.

I tested the script as follows: I included the «delay» command, so that the script waits 5 seconds to execute the «do shell script» command. Then I started the script in Script Editor and immediately sent my display to sleep with an «Active Screen Corner» (Exposé preferences). After 5 seconds my display was undimmed by the AppleScript.


set scriptpath to ((path to desktop as Unicode text) & "usa")
-- set scriptpath to ((path to me as Unicode text) & "Contents:Resources:usa")
-- delay 5
do shell script quoted form of POSIX path of scriptpath