• 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
Passing a Variable to Another Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing a Variable to Another Script


  • Subject: Passing a Variable to Another Script
  • From: "Robert W. Young" <email@hidden>
  • Date: Sat, 11 Feb 2012 09:33:00 -0500
  • Importance: Normal

How can I pass a variable to a script that I'm running from another script as per example below?

Calling Script:

tell application "Finder"
-->   set theName to text returned of (display dialog "What is your name?" default answer "")
    set runAnother to load script (alias "Duo HD:Users:rwyoung:Desktop:Scripting:Running 1 Script Through Another script:Set a Word Script.scpt")
    run script runAnother
    set myTrial to the result
    tell application "SystemUIServer"
        display dialog "The value of property \"myTrial\" is \"" & myTrial & "\""
    end tell
end tell

Script Being Called:

tell application "Finder"
    tell application "SystemUIServer"
-->         display dialog "Do the following, " & myName
        set myTrial to text returned of (display dialog "What word do you want to try to transfer?" default answer "")
    end tell
end tell

I want to pass the variable "theName" created in the calling script to the second script.  I could set up a temporary database containing the variable to be passed, and then access that database from the second script, but that seems long and cumbersome, and I think there must be an easier way.  Any help that can be given will be appreciated.

Thanks in advance,
Bob Young
 _______________________________________________
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: Passing a Variable to Another Script
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Sort error in Leopard
  • Next by Date: Re: More Geek Speak
  • Previous by thread: Re: Sort error in Leopard
  • Next by thread: Re: Passing a Variable to Another Script
  • Index(es):
    • Date
    • Thread