Re: Pass a variable to an include file
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