Re: simple math equations
Re: simple math equations
- Subject: Re: simple math equations
- From: "Arthur J Knapp" <email@hidden>
- Date: Thu, 01 Mar 2001 12:28:14 -0500
>
Date: Thu, 01 Mar 2001 11:04:03 -0500
>
Subject: Re: simple math equations
>
From: "Arthur J Knapp" <email@hidden>
>
Perhaps he is looking for an interface, like an AppleScript calculater:
Here is a slightly different version of the script I posted earlier:
set val to ""
repeat -- "quit" by pressing "Cancel"
display dialog "Please enter an expression" default answer val
-- Any one-line AppleScript expression
--
set exp to text returned of result -- ie: "1 / 0"
try
set val to run script exp
on error m number n
set val to m & n -- > ie: "Can't divide 1.0 by zero."
end try
end repeat
The "default answer" simply becomes the result of the previous
expression, and if the previous expression caused an error, the
error message gets throw back at you without halting execution.
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.AppleScriptSourceBook.com