ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
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.


1 to 1 of 1
  1. Noah Gift photo AppleScript limitations
    2007-05-10 10:26:37  Noah Gift | O'Reilly AuthorO'Reilly Blogger [View]

1 to 1 of 1