On Jan 14, 2011, at 1:52 PM, Christopher Stone wrote: ...I can't find the syntax. Something like this works:
script s parent's AppleScriptFolder end script run s
But when I try something like run script "parent's AppleScriptFolder" it fails.
Hi Chris,
I can't tell what you're aiming for, but here are three snippets that demonstrate 'run script' code that (1) returns the result of some computation: set {val1, val2, myValue} to {12, 15, "Now is the time for all..."} set s to run script ("return text " & val1 & " thru " & val2 & " of \"" & myValue & "\"") --> "time"
or (2) returns a line of compiled AppleScript code as a script object: set varName to "blah" set s to run script ("script s" & return & "set " & varName & " to \"Hello\"" & ¬ return & "end script" & return & "return s") --> set blah to "Hello"
or (3) executes a variable, built-on-the-fly command: -- delete unneeded page items set indesignPage to 1 set deletionList to {"PageNumber", "CategoryName", "ColorBar", ¬ "DividerRule", "Text_1", "Text_2", "Text_3", "Text_4"} -- contents of list will vary set scriptText to {"tell application \"Adobe InDesign CS5\"" & return & ¬ "tell page \"" & indesignPage & "\" of document 1" & return & ¬ "delete (every page item whose name is \"" & (item 1 of deletionList) & "\""} repeat with i from 2 to (count of deletionList) set end of scriptText to (" or name is \"" & (item i of deletionList) & "\"") end repeat set end of scriptText to (")" & return & "end tell" & return & "end tell") run script (scriptText as text)
HTH, Stan C.
|