On 20 Jan 2010, at 23:47, has wrote:
> The send proc callback (which should be installed prior to invoking the
> script and have the same signature as AESend) is called by the AS component
> whenever it needs to dispatch an Apple event. You can then do whatever
> naughtiness you like (including passing the call onto AESend proper).
>
The send proc signature is an augmented version of the AESend signature.
The original issue here was to detect errAENoUserInteraction and conditionaly
transform a foundation tool into a foreground GUI.
The custom send proc approach works well.
Thanks for all your input.
These scripts are often executed as remote instances (as an alternative to
remote targeting using eppc).
It would seem possible, rather than optionally enabling/disabling remote user
interaction, to route the interacting event back over the network to the
originating machine.
AEFlattenDesc() and AEUnflattenDesc() provide AE serialisation services.
Does this sound practicable - or do monsters wait in the weeds?
/*
* function MGSCustomSendProc
*/
OSErr MGSCustomSendProc( const AppleEvent *anAppleEvent, AppleEvent *aReply,
AESendMode aSendMode, AESendPriority aSendPriority, long aTimeOutInTicks,
AEIdleUPP anIdleProc, AEFilterUPP aFilterProc, long refCon )
{
#pragma unused(refCon)
OSErr result = noErr;
// send the event as normal
result = AESend(anAppleEvent, aReply, aSendMode, aSendPriority,
aTimeOutInTicks, anIdleProc, aFilterProc);
//
// look for no user interaction required.
// if the user interaction was disallowed then transform the process
// into a foreground application
//
if (result == errAENoUserInteraction && ![MGSAppleScriptRunner
isForegroundApplication]) {
// transform to foreground application to allow for user
interaction
if ([MGSAppleScriptRunner transformToForegroundApplication]) {
// resend the event
result = AESend(anAppleEvent, aReply, aSendMode,
aSendPriority, aTimeOutInTicks, anIdleProc, aFilterProc);
}
}
return result;
}
Thanks
Jonathan
>
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]