Dave wrote:

> I’m using the Scripting Bridge to Target MS Outlook. I’m trying to figure out how to do the following AppleScript using the Scripting Bridge. Please see Full Script below, I’ve got most of the code, but I can’t seem to figure out the right Objective-C code for these two statements:

Scripting Bridge doesn't work properly; never has, never will. According to the Apple developer that wrote it, it wasn't designed to work with Carbon apps (which is funny cos it doesn't work right with Cocoa ones either). Maybe your AS code will translate; maybe it won't. Maybe it'll work, maybe it won't. If it doesn't, you'll have zero clue why. For anything non-trivial, you're best sticking to AppleScript: it's the ONLY[1] solution that actually works right.

Since you're using ObjC/Cocoa and already have a working AppleScript implementation, the neatest solution is to use the AppleScript-ObjC bridge to call your AppleScript code directly. Just wrap your AS code as handlers in script objects that inherit from NSObject, and you can call them pretty much as you would native ObjC methods. Quick how-to here:

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

HTH

has

--

[1] Specifically, it's the only *currently supported* solution that works right. I no longer support appscript, am not going to waste anyone's time promoting AppleEventBridge (which I only did in a failed attempt to prevent the Automation team screwing up JavaScript too), and I'm not interested in finishing/supporting SwiftAE unless Apple can be persuaded to adopt it for OS X. If anyone here still cares about Mac Automation, please feel free to contact me off-list with any advice/criticism/encouragement/support.

http://appscript.sourceforge.net
https://bitbucket.org/hhas/appleeventbridge
https://bitbucket.org/hhas/swiftae  (docs: http://hhas.bitbucket.org)
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to