Re: Creating a script from within a script and running it
Re: Creating a script from within a script and running it
- Subject: Re: Creating a script from within a script and running it
- From: Axel Luttgens <email@hidden>
- Date: Tue, 08 Oct 2013 19:56:34 +0200
Le 8 oct. 2013 à 17:20, Jim Brandt a écrit :
> [...]
>
> So, my question is, is it possible to build a dynamic script such as this
> and get it to return a result (in this case a list)?
Hello Jim,
The result is the one returned from the run handler; and, strictly speaking, that handler expects a list as argument.
Here follows a slightly modified version of your script, mainly in an attempt to make the script construction a bit more legible:
set PR to {dd:"2013-10-08", div5:"0", div2:"0", Client:"My Client", div3:"1", div4:"0", div1:"1", cb:"0"}
set Divisions to {"Division1", "Division2", "Division3", "Division4", "Division5"}
set CountChecked to "
on run L
set P to item 1 of L
set Divs to item 2 of L
set DC to {}"
repeat with i from 1 to count of Divisions
set CountChecked to CountChecked & "
if div" & i & " of P = \"1\" then set end of DC to item " & i & " of Divs"
end repeat
set CountChecked to CountChecked & "
return DC
end run"
set DivisionChoices to run script CountChecked with parameters {PR, Divisions}
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden