Integrating an applescript into a screensaver
Integrating an applescript into a screensaver
- Subject: Integrating an applescript into a screensaver
- From: "Jacob Eggers" <email@hidden>
- Date: Sat, 17 Feb 2007 13:52:21 -0500
I'm brand new to cocoa, so I was hoping someone could explain something to
me.
Loading a script in the standard way:
NSBundle *theBundle = [NSBundle mainBundle];
NSString *scriptPath = [theBundle pathForResource: kScriptName ofType:
kScriptType];
NSURL *scriptURL = [NSURL fileURLWithPath: scriptPath];
myScript = [[NSAppleScript alloc] initWithContentsOfURL: scriptURL
error: &errorInfo];
doesn't work. Because the applescript isn't copied over to the resources
file of the ScreenSaverEngine.app.
Instead, I had to hand code the resource path and use the following code:
NSBundle *theBundle = [NSBundle bundleWithPath:theResourcesPath];
NSString *scriptPath = [theBundle pathForResource: kScriptName ofType:
kScriptType];
NSURL *scriptURL = [NSURL fileURLWithPath: scriptPath];
myScript = [[NSAppleScript alloc] initWithContentsOfURL: scriptURL
error: &errorInfo];
This solution works, but is less than satisfactory. Does someone have a
better method?
j
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden