• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Integrating an applescript into a screensaver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Integrating an applescript into a screensaver
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Learn Cocoa: Part II
  • Next by Date: Report generation tools
  • Previous by thread: Learn Cocoa: Part II
  • Next by thread: Re: Integrating an applescript into a screensaver
  • Index(es):
    • Date
    • Thread