Article:
 |
|
Using Python and AppleScript Together
|
| Subject: |
|
AppleScript limitations |
| Date: |
|
2007-05-10 10:14:50 |
| From: |
|
salamon
|
|
|
|
AppleScript has a number of limitations when run remotely, via the command line. For example, I logged into my home machine and tried the sleep command and here's what I got:
Ripley:~ andrew$ osascript -e 'tell app "Finder" to sleep'
kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only
INIT_Processeses(), could not establish the default connection to the WindowServer.Abort trap
If i try to run it as root, as the error message suggests, I get:
21:26: execution error: Finder got an error: Application isn't running. (-600)
I get the same errors when running your python version.
There is a small app called SleepNow (see http://sleepnow.darwinports.com/) that will work under those conditions.
|
Showing messages 1 through 1 of 1.
You could always craft a very comprehensive filter that accepts only email messages from a certain address with a certain keyphrase in the the subject line. You could then trigger the sleep code...
One other thing that works remotely as root:
killall loginwindow
This will immediately log you out. Be kind with this command!