asynchronous scripting in a multi-threaded cocoa application
asynchronous scripting in a multi-threaded cocoa application
- Subject: asynchronous scripting in a multi-threaded cocoa application
- From: nibs ra <email@hidden>
- Date: Mon, 7 Apr 2003 06:17:47 -0700
i also sent this to the applescript implementers mailing-list so i
apologize for any duplication.
hi,
i have a scripted cocoa application, and i'd like to know of a way to
handle applescript messages asynchronously from within the cocoa
scripting model; so that the messages can be processed on a separate
thread and the results sent back when processing is done. i was
pointed to the lower level carbon api's:
AEGetTheCurrentEvent()
AESuspendTheCurrentEvent()
AESetTheCurrentEvent()
AEResumeTheCurrentEvent()
but i'm not sure what i would need to do at the higher levels (where
cocoa abstracts the api) to fit in with this model.
it looks like i could implement a subclass of NSAppleEventManager and
then override:
+[NSAppleEventManager sharedAppleEventManager]
and then use posing to get my subclasses implementation called, and
then override:
-[NSAppleEventManager
dispatchRawAppleEvent:withRawReply:handlerRefCon:]
and then:
call the super implementation to schedule the event asynchronously
suspend the apple event and wait for the processing to be complete
resume and fake the response from the event
it seems like something similar could be done a little higher up
utilizing a custom NSScriptCommand and subclassing/posing as
NSScriptingAppleEventHandler but that class seems completely private.
is this necessary? will that work? is there a simpler, more
straight-forward way to do all of this?
tia,
nibs
_______________________________________________
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.