Recent comments
Recent topics
Recent wiki edits
|
Applescript Patch: A BeginningAppleScript in Quartz Composer would be useful for one particular advantage over Javascript: It has its same dictionaries, etc, wherever it is implemented. That means calls to Address Book, Safari, and System Events. I want AppleScript right now so I can bring another application's window to the front, but I know of plenty of other uses. This is only a decent start, as I can't figure out how to pass a variable number of arguments to the applescript the way I'm doing things AppleScript Patch Goals
Implementation: In Leopard's Official API, create a plugin with an interface. In your header file, specify two inputs. one a boolean, shouldRun, which will tell our patch when to run, and the other an Index (integer), numArgs, that tells us how many variable inputs we need. These are 'real' inputs, as in a patch that completes my goals, we'd have argument support. Create one non-input Objective-C 2.0 properties, a NSString called script. Plunk a text box down in Interface Builder, and bind it to PlugIn.script. This is where the user enters his/her applescript. Scripts are entered into the text box, with arguments passed to any value called %@ or %d or whatever, in order. Here's most of the code for your main block:
if (self.shouldRun) {
//for errors, we have this!
NSDictionary *errorContainer = [[NSDictionary alloc] init];
So, who can solve the dynamically creating argument inputs problem?
|
as an aside
use shellscript patch with "osascript -e 'your applescript goes here'" for one-liners.
perhaps look at the source of the shellscript patch as well to get a model for such things.
i'm in the middle of something fiddly myself, so can't get stuck into this right now.