• 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: Pass a variable to an include file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pass a variable to an include file


  • Subject: Re: Pass a variable to an include file
  • From: jj <email@hidden>
  • Date: Wed, 16 Mar 2005 13:27:42 +0100

> Hi
>
> I have an application which gets a value from a text field (no
> problem), later on in the code I need to run an include file (no
> problem)
>
> set strRunScript to run script alias strIncScript
>
> My problem is, when I run the include file I need to get the value from
> the text field as specified earlier (from the master doc) and use the
> variable within the include file but dont seem to be able to pass the
> value over (applescript give me the error 'the variable strTextFieldID
> is not defined'.

There are varios ways. Eg:

SCRIPT 1:

set strTextFieldID to "foo"
run script alias strIncScript with parameters strTextFieldID

SCRIPT 2:

on run {strTextFieldID}
    display dialog strTextFieldID
end run

Or simply calling a handler:

SCRIPT 1:

set strTextFieldID to "bar"
(load script alias strIncScript)'s h(strTextFieldID)

SCRIPT 2:

on h(x)
    display dialog x
end h

Or you could even write "strTextFieldID" to a text file and read it later
from "SCRIPT 2".


jj

--
http://www.macscripter.net/
http://www.osaxen.com/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Pass a variable to an include file
      • From: Steve Foster <email@hidden>
References: 
 >Pass a variable to an include file (From: Steve Foster <email@hidden>)

  • Prev by Date: Re: Require info
  • Next by Date: Re: Require info
  • Previous by thread: Pass a variable to an include file
  • Next by thread: Re: Pass a variable to an include file
  • Index(es):
    • Date
    • Thread