[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Passing variables from applescript to perl.



At 12.38 11/22/97, Peter Gradwell wrote:
>$getNumOfMessages = <<END_SCRIPT;
>        set mailbox_list to {"www-scripts daemon"} -- list of mailboxes to
>transfer
>
>        set num_lists to count mailbox_list
>        repeat with list_num from 1 to num_lists by 1
>                set mailbox_name to item list_num of mailbox_list
>                tell application "Eudora Pro 3.1.1"
>                        count each message of mailbox mailbox_name
>                end tell
>                set message_count to the result
>        end repeat
>
>$num_messages = message_count;

Change this to return message_count

>&MacPerl'DoAppleScript($getNumOfMessages);

$num_messages = MacPerl::DoAppleScript($getNumOfMessages);

>print ("Num Messages ",$num_messages,"\n");
>
>--end--
>
>is a bit of perl I have that should set the perl variable $num_messages to
>the number of messages in the mail box "www-scripts daemon", however it
>doesn't work.

You will note that the statement C<$num_messages = message_count;> is part
of the AppleScript, so it is not doing anything in Perl, but in
AppleScript.  Anyway, whatever AppleScript returns is returned by the
DoAppleScript function, so $value = MacPerl::DoAppleScript($script) gets
the return value.

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch