PDA

View Full Version : Creating a random number within a URL using Applescript




moorbull
Jul 19, 2012, 06:25 AM
Hi,

I'm quite new to applescript and guess this may be easy for some of the more experienced users to answer but I'm wondering..

How can I generate a random number with a URL and then get safari to visit the URL..

So for example.. http://example.com/something=(RANDOM NUMBER)&something=......

Thanks a lot



kryten2
Jul 19, 2012, 08:16 AM
-- random number between 0 and 1000
set randomNumber to (random number (1000)) as text
open location "http://example.com/something=(" & randomNumber & ")&something=....."
--or
set theURL to "http://example.com/something=(" & ((random number (1000)) as text) & ")&something=....."
open location theURL