Hello all, I'm trying to do some interprocess communication using AppleEvents from MacPerl and was hoping someone here could steer me in the right direction. I'm creating AppleEvents based on Chris' excellent Perl Journal article (thanks, Chris!) and what I can learn about them from CaptureAE. The example below brings up a Frontier 4.2.3 script, but I've had the same problem with copying a large folder. What happens is, when I get to the point where I do a lengthy operation, the application's AppleEvent times out. The operation continues to conclusion, but the Perl script stops at that point. So my question is, what's the best way around this? I've tried using the "&timo:720000" construct to set the AE timeout to about three hours, but not all of the AEs I construct like that (the Frontier call especially doesn't like it) and on the ones that do, like the one below, it still times out. eval{} proceeds as soon as the code it's trying to evaluate hits an error, which is worse than not having the eval{} at all. :) Thanks for any suggestions you might have. Regards, -- Creede ========================================================================== Creede Lambard 44/2307 | International Build Architect, Bon Vivant, One Microsoft Way | All Around Nice Guy and Just Another Perl Hacker Redmond, WA 98052 |================================================= (425) 703-2255 x13408 | "Know what happens when you rush a miracle man? a-creela@microsoft.com | You get lousy miracles." -- The Princess Bride ========================================================================== #!perl -w use Mac::AppleEvents; # select the Frontier alias on my desktop # # each of these AppleEvents is really all one line, # but I've broken them up to make them readable. print &MakeAE( "MACS", "misc", "slct", ["'----':obj { form:name, want:type(cobj), seld:ÒFrontierÓ, from:obj { form:prop, want:type(prop), seld:type(desk), from:'null'() } } "]); # In MacOS, the "Ò" and "Ó" are actually curly quotes # I hope they show up that way after being run through Outlook :( # Open the selection print &MakeAE( "MACS", "aevt", "odoc", ["'----':obj { form:prop, want:type(prop), seld:type(sele), from:'null'() }"]); # Activate Frontier -- don't know if that's strictly necessary # but it doesn't seem to hurt and besides it contains the &timo # line detected by CaptureAE that doesn't seem to change the # timeout status of the Frontier script print &MakeAE( "LAND", "misc", "actv", ["&subj:'null'(), &inte:cans, &timo:720000"] ); # This calls the Frontier script in question $command = qq['----':Òlocal.verbs.myscript("parameters")Ó]; print &MakeAE("LAND","misc","dosc",[$command]); # The command above generates an "AppleEvent timed out" error, # which causes MacPerl to stop running the script. Frontier finishes # running the local.verbs.myscript script, but there are several # other things below here that I would like to do (like processing # the output of myscript) that I can't because MacPerl stops processing # as soon as it hits the time out error. print &MakeAE("LAND","card","clos",[""]); print &MakeAE("LAND","aevt","quit",["&subj:'null'()"]); # . . . more stuff goes here # # this is the end of the script proper # Build the AE out of what got passed to us sub MakeAE { my ($target,$class,$id,$params) = @_; %ae = ( target => $target, class => $class, id => $id, params => $params # must be a reference to an anonymous array! ); @Event = &AppleEvent(%ae); return $Event[1],"\n"; } # This is straight out of Chris' article sub AppleEvent { my (%ae) = @_; my ($event,$reply); my @ret_value = (); $event = AEBuildAppleEvent( $ae{'class'}, $ae{'id'}, 'sign', $ae{'target'},0, 0, @{$ae{'params'}} ) || die($^E); $reply = AESend($event, kAEWaitReply) || die($^E); push @ret_value, AEPrint($event); push @ret_value, AEPrint($reply); AEDisposeDesc($event); AEDisposeDesc($reply); return @ret_value; } ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org