On Dec 13, 2009, at 9:17 AM, Chris Harbinson wrote:
> Hi, Folks,
>
> After about a five-year gap, I've been forced back into scripting. I'm enjoying it and am just beginning to add Javascript to my armoury.
>
> However it is good ole Applescript, or rather my forgetfulness, that is giving me problems.
>
> I keep on setting out to do things that I think I know and then discovering I've lost 'em.
>
> At the moment I am working on twin scripts. The first one does a bit of information gathering, storing its harvest in a variable called myWonderfulList, performs some helpful tasks before setting the user free to do his or her thing for a while.
>
> When the user is ready, script two is activated ... and it really needs to be able to make use of the information in myWonderfulList.
>
> It's getting myWonderfulList from script 1 to script 2 without too much clumsiness that's puzzling me at the moment.
>
> A doddle to all of you, I'm sure.
>
> Hope you've been keeping well since last I wrote.
>
> Chris
>
There are a couple of ways to do it.
If script2 isn't running
Script 1
set ascript to load script POSIX file "/Users/lively/Desktop/Untitled.app"
set mylist of ascript to {"1", "B", 3, {1, 2, 3}}
store script ascript in POSIX file "/Users/lively/Desktop/Untitled.app" with replacing
Script 2
property myList : ""
repeat with anItem in myList
display dialog anItem
end repeat
If script2 is runnining you can to this
Script 1
tell application "Script2"
setData({"A", "B", {1, 2, 3}})
end tell
script 2
property mylist : ""
on idle
if mylist ≠ "" then
repeat with anitem in mylist
display dialog anitem
end repeat
return 5
end if
end idle
on setData(aList)
set mylist to aList
end setData
-Mark
The once and future geek.
|