On Jan 18, 2010, at 10:04 PM, jonat...@mugginsoft.com wrote:

>> Or use TransformProcessType to elevate your Unix style executable to GUI 
>> status: [...]

> Looking at rb-appscript [...] the process is transformed only when error 
> -1713 occurs.

Correct, errAENoUserInteraction = -1713.


> Ideally I would like to examine my AppleScript for the presence of syso/dlog 
> et al and transform it accordingly.
> Searching has revealed that "a custom send proc" might be suitable.
> Ignorance prevents me from proceeding further. 
> The goal is:
> 
> if my script aeDesc contains eventid:{dlog, aleR, chcl, chlt, chra, chur, 
> disA, nwfl, ppcb, stdf, stfl)
>       transform_process_to_foreground_application procee
> end if


As you say, install a custom send proc into the AppleScript component. 
Personally, I would have it send the event and sniff for errAENoUserInteraction 
in the reply event, as third-party osaxen may run into the same problem and you 
can't reasonably check for every possible event code beforehand. If an 
errAENoUserInteraction is found, elevate the process then resend the event. 
(Since it's already been responded to, I think it'll be safe to reuse the 
original AppleEvent descriptor as-is without having to futz with obtaining a 
new return ID.)

You can't install custom send procs via NSAppleScript. Can't recall offhand if 
OSAKit allows it, otherwise you'll need to get down and dirty with the crusty 
old Carbon OSA API. Which isn't all that hard, though OT for this list.

Alternatively, you could just be a pedant and insist anyone running AppleScript 
targets dialog commands at System Events. This avoids the need to elevate your 
GUI-less process in the first place, which also has side-effects such as 
creating a menubar and Dock icon; that's what ASers do when using dialog 
commands from osascript.


> We can switch this to applescript-implementors if required.

I would suggest taking further emails there - quieter and better suited to the 
subject.

Regards,

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to