Re: run script
Re: run script
- Subject: Re: run script
- From: Nigel Garvey <email@hidden>
- Date: Thu, 25 Oct 2001 01:27:53 +0100
Nicolas Descombes wrote on Wed, 24 Oct 2001 23:38:24 +0200:
>
Hello,
>
>
I'm french and I'm sorry for my english.
>
I would want, with a dialog box, enter a formula with one or more variables.
>
I tried with this script but AppleScript wants that I define the variable
>
>
[Script]
>
set Dialogue_2 to display dialog "Type formula" default answer ""
>
set Formula to text returned of Dialogue_2--for exemple : x+x
>
set x to 2
>
set total to (run script Formule)--normally equal to 4
>
[/Script]
>
>
How can I do to define the variable and obtain a result for my formula
The easiest way is to make "set x to 2" part of the 'run script' string:
set Dialogue_2 to display dialog "Type formula" default answer ""
set Formula to text returned of Dialogue_2
-- Make 'Formula' into an entire script:
set Formula to "set x to 2" & return & Formula -- don't forget the
return
set total to (run script Formula)
NG