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

Re: [MacPerl] Passing variables between applescript and perl.




Chris Nandor replies:
:  At 07.05 11/24/97, Carl Baltrunas & Cherie Marinelli 1.6v2 wrote:
:  >I have an application which can be passed AppleEvents and I have a set of
:  >example scripts written in AppleScript to send and receive transaction
:  >records from the application.
:  >
:  >What I want to be able to do is to read email messages from one of my
:  >mailboxes ... ...
:  
:  I am assuming here that you are talking about an application other than
:  your mail application; i.e., this is something the mail snippet Paul gave
:  you can only partially work for?

Yes.  Paul's example will help me format my email text, so I can build the
record or list needed to send to the application. An example AppleScript
snippet looks like...

==
tell application "xxx"
    global fromXXX, toXXX
    set toXXX to {Item1:data1, Item2:data2, Item3:data3, Item4:data4}
    set fromXXX to (Command Option With Properties toXXX)
    set myStatus to Status in fromXXX
    set myResponse to Response in fromXXX
    if Status in fromXXX = OK then -- if approved, move approval fields in
        set myData1 to Item1 in fromXXX
        set myData2 to Item2 in fromXXX
        display dialog "Result: " & myResponse & "   Text: " & myCode buttons {"OK"}
    else
        if Status in fromXXX = BAD then
            display dialog "Result: " & myResponse & "  Oh No!" buttons {"OK"}
        else
            display dialog "Result: " & myResponse buttons {"OK"}
        end if
    end if
end tell
==

I can get the Data1, Data2, Data3, Data4 from the email messages via Perl, no
problem.  I need to know from perl, how to send the right AE's to the program
so that it has the same effect as what the above AppleScriot does to the program.
Then, I need to be able to read the Status, Item1, Item2, and Response so that
I can generate a table entry in a log file, then generate an automatic email
resonse to whomever sent me the message.

Right now, I'm doing all of this by hand, and would like to automate it.  But,
my lack of experience with both AppleScript and AE's in general have left me
not knowing where to begin.  If I have to format a complete AppleScript with
the data elements embedded in the script for each record, that's fine... if
It can be done completely via AE's and with Perl, that's my hope at this time.
:  
:  >If this can be done without involving AppleScript, Great!  But I'm in need
:  >of a reference to an AE example in MacPerl that deals with records, or how
:  >to translate applescript AE commands into macPerl.
:  
:  Yes, it can.  It is not the simplest of measures, though.  I have an
:  article coming out in The Perl Journal in mid-December that deals precisely
:  with this: creating and sending Apple Events, and how to figure out what it
:  should look like.

Now that I've given a specific example, maybe you can tell me if your article
is on topic for what I need to do, or if there are other examples lying around
that I can look through.
:  
:  I am also in progress on a chapter for my book with Vicki Brown that will
:  deal just with Apple Events, AppleScript, and OSA (thought mostly with
:  Apple Events).
:  
:  When that chapter is available, I will announce it.  The article, when
:  completed, is likely going to be posted online, though I recommend that you
:  subscribe to The Perl Journal anyway, as it is a great publication.
:  
:  --
:  Chris Nandor               pudge@pobox.com           http://pudge.net/

Thanks Chris... I'll be looking forward to yur article, but am also interested
in what ever otehr resources are available before then, probably helping me
follow your article a bit better.

-Carl


Carl A Baltrunas <carl@reststop.com> and Cherie Marinelli <2bunnies@1unique.com>
Catalyst Industries: The One-Stop Internet registration and distribution service
URL: <http://www.reststop.com>    INFO: info@1unique.com
-owned by EWBR & EWBR-ette [our house bunnies] and Czazu [our dog]
 Visit them at their hotel at http://www.reststop.com/info/bunny/bunnycam.html



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