best practice with helper AppleScript
best practice with helper AppleScript
- Subject: best practice with helper AppleScript
- From: Christopher Corbell <email@hidden>
- Date: Tue, 24 Jun 2003 18:19:13 -0700
I'm not sure if this is more a Cocoa or AppleScript question,
but I thought I'd start here.
What's the best practice for integrating an AppleScript
with an Obj-C Cocoa app?
Here is the context:
- the script operates on a third-party app
- the only thing about the script which changes at runtime
is the file path (which is passed to the third-party app in
a tell statement)
Here are the options I've explored:
1) Since the script is small, include it as hard-coded text and
interpolate the variable HFS file path into this source at runtime.
Then compile and launch it with NSAppleScrip,t or with Carbon
facilities.
2) Include the script inside the app bundle. Pass the location
of the file as a parameter to the script.
I haven't gotten either of these approaches to work 100%.
NSAppleScript keeps choking on character issues, even if
I keep everything pure MacRoman up to the very end (when
I call [NSString stringWithCString] to create the script source).
I have used the Carbon API's to compile and run a script before,
but this seems like a step backward in a post-10.2 Cocoa app.
I can easily put the script in the app bundle, the problem is that
I don't know how to pass an argument to it when I launch it.
Is there an easy way to do this in Cocoa, without having to
treat the script as an application and stuff Apple Event descriptors?
What does everyone else do?
Thanks in advance,
Christopher
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.