• 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: Unquoting a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unquoting a string


  • Subject: Re: Unquoting a string
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 14 Jul 2002 16:56:55 -0700

On 7/14/02 4:32 PM, "Robert Stretch" <email@hidden> wrote:

> Hi there,
>
> If I have the small scripts:
>
> 2 * 2 OR 2 + 2 etc...
>
> The only way for AppleScript not to recognize them as a string of text
> is for me not to have them in quotes (" "). So what happens when I have
> a dynamic string of text which needs to be equated? For example if i
> display a dialog with a text field like so:
>
> set theEquation to display dialog "Please type an equation here:"
> default answer "Type Here..."
>
> Then the result is a QUOTED equation. So my question is, after all
> that, how do I make it so that AppleScript recognizes the equation for
> what it is supposed to be, an unquoted equation, and calculate it?

the Standard Addition 'run script' runs strings as scripts. First you
need to get the text returned of the display dialog:

display dialog "Please type an equation here:" default answer "Type
Here..."
set theEquation to text returned of result
--> "2 + 2"

set theResult to run script theEquation
--> 4


--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Unquoting a string (From: Robert Stretch <email@hidden>)

  • Prev by Date: Re: Unquoting a string
  • Next by Date: Re: applescript-users digest, Vol 3 #618 - 11 msgs
  • Previous by thread: Re: Unquoting a string
  • Next by thread: Re: Unquoting a string
  • Index(es):
    • Date
    • Thread