Chunk 1978 wrote:

when running my apple script i get this error:

-=-=-=-
System Events got an error: Access for assistive devices is disabled.
-=-=-=-

so if i goto system prefs and check "Enable access for assistive
devices", then running the script i get this error:

-=-=-=-
System Events got an error: Can't get application process "System Preferences".

Did you remember to activate System Preferences first?

activate application "System Preferences"
tell application "System Events"
        tell application process "System Preferences"
        ...
        end tell
end tell


However, before going down the GUI Scripting route, which is brittle and prone to failure, check out the Desktop Suite in System Events. The APIs a bit schlonky, but it may do what you want. Example using objc-appscript:

#import "SEGlue/SEGlue.h"
SEApplication *systemEvents = [SEApplication applicationWithName: @"System Events"];
SEReference *ref = [[systemEvents currentDesktop] pictureRotation];
id result = [ref setItem: [NSNumber numberWithInt: 0]];

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to