• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert Text to Variable Name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert Text to Variable Name


  • Subject: Re: Convert Text to Variable Name
  • From: Stan Cleveland <email@hidden>
  • Date: Fri, 14 Jan 2011 15:56:03 -0800

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.

 _______________________________________________
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

  • Follow-Ups:
    • Re: Convert Text to Variable Name
      • From: Christopher Stone <email@hidden>
References: 
 >Convert Text to Variable Name (From: Christopher Stone <email@hidden>)
 >Re: Convert Text to Variable Name (From: André Renault <email@hidden>)
 >Re: Convert Text to Variable Name (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: What is class furl?
  • Next by Date: Re: Convert Text to Variable Name
  • Previous by thread: Re: Convert Text to Variable Name
  • Next by thread: Re: Convert Text to Variable Name
  • Index(es):
    • Date
    • Thread