Section B.4. Numbers


B.4. Numbers

Although AppleScript and HyperTalk deal with math operations the same way (with symbols like + for addition, / for division, and so on), HyperTalk has a few keywordslike add and multiplythat simply aren't supported in AppleScript. For example, if you have a variable named myNumber in HyperTalk, you can use the following commands:

add 2 to myNumber multiply myNumber by 5

AppleScript can't understand either of those commands, though. To accomplish the same job in AppleScript, you'd have to write this:

set myNumber to myNumber + 2 set myNumber to myNumber * 5

Another feature that AppleScript lacks is the ability to use trigonometric functions like sin, cos, and tan (which work just fine in HyperTalk). If you need those commands for your script, download a trigonometry scripting addition (Sidebar 3.5).



AppleScript. The Missing Manual
AppleScript: The Missing Manual
ISBN: 0596008503
EAN: 2147483647
Year: 2003
Pages: 150

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net