• 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
Re: Running AppleScripts from an App using NSAppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running AppleScripts from an App using NSAppleScript


  • Subject: Re: Running AppleScripts from an App using NSAppleScript
  • From: has <email@hidden>
  • Date: Tue, 28 Apr 2015 11:56:19 +0100

Dave wrote:

> I have a number of AppleScripts I’d want to run from my App. Each Script has a couple of parameters [...]

Example code here:

    http://appscript.sourceforge.net/nsapplescript.html

The downside (one of them anyway) is that you have to do all of the Cocoa<->AE packing and unpacking yourself. If you're passing complex data, I suggest pinching and adapting the AEMCodecs class from here:

    https://bitbucket.org/hhas/appleeventbridge/src

If the scripts are part of your .app bundle, another option is to use the AppleScript-ObjC bridge, which allows you to call AS handlers directly from ObjC:

    http://appscript.sourceforge.net/asoc.html

It's not perfect - there's no way to declare non-id signatures (you have to wrap and unwrap C primitives yourself) and some of the AE type bridging is problematic (NSDate/typeLongDateTime isn't automatically bridged, and the typeObjectSpecifier mapping is defective), but for most tasks it's the least painful option.

HTH

has
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Prev by Date: Re: Sketch TNG Code?
  • Next by Date: New information. Was: Re: Weird UITableView problem
  • Previous by thread: Re: Running AppleScripts from an App using NSAppleScript
  • Next by thread: Sketch TNG Code?
  • Index(es):
    • Date
    • Thread