>Hello, >I'm not very familiar with AppleEvents and I was wondering if there is a >_simple_ way to send directly an AppleEvents to Frontier and get back the >result in MacPerl. >#!Perl > >$script = <<EOS; > tell application "UserLand Frontier" > Do Script "clock.now()" > end tell >EOS > >$frontierResult=MacPerl::DoAppleScript($script); >print($frontierResult); Hi, the following script is a purely mechanical adaption of Matthias 'recipe_as_osa' from his Perl Anarchists Cookbook, borrowing two lines from Chris' AETutorial to make MacPerl print the result. I guess you could use almost any simple Frontier Script instead of "clock.now()" and leave everything else as it is. Send me a report on your experiences. MacPerl will cough up an error if Frontier is not running before you run the script. Matthias' example is easier to understand (since it is kept very simple and does not make use of a return value), but I prefer the hard stuff since you can get more information out of it - or get holessly lost ;-).) ******************* #!perl # # recipe_osa_LAND - Adapted from Perl Anarchist's Cookbook using OSA compiled Frontier scripts. # use Mac::Components; use Mac::OSA; use Mac::AppleEvents; $UserTalk = OpenDefaultComponent(kOSAComponentType, "LAND") or die $^E; sub Compile { $script = AECreateDesc "TEXT", @_[0] or die $^E; $id = OSACompile $UserTalk, $script, 0 or die $^E; AEDisposeDesc $script; $id; } $showClock = Compile qq{ clock.now() }; sub showClock { $value = OSAExecute $UserTalk, $showClock, 0, 0 or die $^E; $time = OSADisplay($UserTalk, $value, 'TEXT', 0) or die $^E; OSADispose $UserTalk, $value; print AEPrint($time), "\n"; } showClock; OSADispose $UserTalk, $showClock; CloseComponent $UserTalk; ********************* Mail me privately (although I am not at all an expert - I just played around with AE for a couple of weeks and beginn to make sense of what is going on) if you don't want to bother the list, but I guess quite a couple of people are interested in this kind of problem. Cheers, Peter Hartmann Visiting Scholar Ritsumeikan University, Kyoto, Japan e-mail: hartmann@mbox.kyoto-inet.or.jp (preferred) phv00542@askic.kic.ritsumei.ac.jp ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch