Team LiB
Previous Section Next Section

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).

    Team LiB
    Previous Section Next Section