random number?

ive recently been fiddling with apple script and i would like to know how to generate a random number and display it in a dialog…
thanks in advance :slight_smile:

The following is a very simple example to answer your question.


-- random number requires the Standard Additions Osaxen
random number from 0 to 500 -- lower & upper limits are setable
display dialog result

:smiley:

another question… Standard Additions Osaxen ? wats this? where can i Download it will it work on my applescript? ( version 1.1.3)
if not where can i download a newer version?
thanks again :slight_smile:

I use OS 8.6 and AppleScript v1.1.3
The Standard Additions Osaxen must be installed in the Scripting Additions folder of your System Folder.
If you email me with your email address I will send you a copy of the osaxen
pcourtade@adelphia.net
:shock:

Check in your System Folder for a folder named Scripting Additions. A scripting addition is the same thing as an osax. You likely already have Standard Additions.

Disclaimer: If your Mac uses a language other than English, I don’t know what the correct names might be. :wink:

hrrm thanks for youur help so far but still no luck…
turns out i already had scripting additions…
i tried this
tell “finder”
random number from 0 to 500
display dialog result
end tell
(is this wat im meant to put? i really dont know much about applescript)
And i got this message
“Finder” does’t understand the random number messgae

wat have i done wrong? :?
WOOPS! its not a tell… sry guys an girls… but any ideas on how to make this into a guess the number game?.. like they type wat they think it will be hit play and then the result pops up with a you lose/win message?
also is keeping score posible?

You don’t need the Finder to do this. Try this:

random number from 0 to 500
display dialog result