Re: run script
Re: run script
- Subject: Re: run script
- From: Shane Stanley <email@hidden>
- Date: Thu, 25 Oct 2001 10:57:08 +1000
On 25/10/01 9:52 AM +1000, Nicolas Descombes, email@hidden,
wrote:
>
>> 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
>
>
>
> AppleScript has no way of knowing that "x+x" means you want to add x to x.
>
> You will have to parse out the meaning, which could get very complex,
>
> depending on what sort of mathematics the user enters.
>
>
Thanks for your response. But why if the text returned of Dialogue_2 is
>
"2+2", "run script Formule" is equal to 4 without message error ?
>
Thanks for your help
I think I see what you're after -- does this help:
set Dialogue_2 to display dialog "Type formula" default answer ""
set Formula to text returned of Dialogue_2 --for example : x+x
set y to "set x to 2"
set total to (run script (y & return & Formula))
--
Shane Stanley, email@hidden