Re: Setting Script variables with Apple Events
Re: Setting Script variables with Apple Events
- Subject: Re: Setting Script variables with Apple Events
- From: David Simerly <email@hidden>
- Date: Mon, 29 Apr 2002 15:37:30 -0700
- Url: http://www.digital-native.com
on 4/29/02 7:58 AM, Pier Kuipers at email@hidden wrote:
>
'----':obj {form:name, want:type(file), seld:"Hard Disk:ScriptName",
>
from:'null'()}, plst:["", "", "", "", "", ""]
>
>
Where "plst" is parameter list that gets fed to the script in
>
question. My problem is, how do I get the script to pick up these
>
parameters - what should my script look like? Do I need to declare a
>
property at the top level of the script?
>
>
Thanks for any help...
Hi Pier,
Well, I've used MPW's sendAE command quite a bit which is a bit easier than
working with raw AE's. From what I can tell of AE above, the problem will
not be calling the script and passing the parameter, but figuring out where,
in the AE structure, to call the specific handler for the task. I've
enclosed one of my sendAE calls from MPW, a CaptureAE breakdown of the
event, and the receiving handler from the target script as an example. This
won't answer your specific question, but it might show you how the entire
mechanism is supposed to work enough so that you can make the final
connections yourself.
The first two params in the sendAE call are the target script (a standalone,
stay open...), and the second param is receiving handler. The stuff up until
the -timeout are the parameters/data format for the AS handler, and the
-timeout param sets the timeout period for the AE.
-- begin example: mind the e-mail inserted line breaks...
-- sendAE MPW call...
sendae -t "FMNewRec.scpt" -e "FMNewRec"
-dbnmTEXT "{db_name}"
-lonmTEXT "{layout_name}"
-trgpTEXT "{db_ip_addr}"
-dataTEXT "{fmp_data_block}"
-timeout 6000 # 1 minute
-- AE constructed by sendAE & caught w/CaptureAE...
Process("FMNewRec.scpt").SendAE "FMNe,wRec,dbnm:3Main Storehouse2,
lonm:3Input2, trgp:3TauCeti:Prime:2,
data:3Canon
Digital'USB/Firewire'$499.00'32mb'1 slot'3" LCD''''2"
-- receiving AS handler in stalone script applet FMNewRec.scpt...
on +event FMNewRec; given +class dbnm;:db_name, +class lonm;:lo_name, +class
trgp;:targ_path, +class data;:fmp_data
-- guts goe here...
end +event FMNewRec;
-- end example
As you can see, the AE call contains all the elements to create a complete
path to the AS handler and each param. The actual handler call is broken
into two, four-character codes (FMNe,wRec) that AppleScript will reassemble
back into the handler "FMNewRec".
In your AE, I see a spot for the name of your script, 'seld:"Hard
Disk:ScriptName"' which lets you launch or pass messages to the script, and
there's the "plst:[]" part for passing params, but I'm not quite sure where
you handler call belongs. Possibly the "form:" and "want:" fields? Once you
figure out how to contact the appropriate handler in your script, it should
be straightforward to parse your data using TID's. HTH. Good luck!
DS
_____________________________________
Digital Native
Your guide through the virtual jungle.
______________________________________
Ever Wonder: Why is "abbreviated" such a long word?
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.