Creating a random number within a URL using Applescript

Discussion in 'Mac Programming' started by moorbull, Jul 19, 2012.

  1. macrumors newbie

    Joined:
    Jul 19, 2012
    #1
    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
     
  2. kryten2, Jul 19, 2012
    Last edited: Jul 19, 2012

    macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Code:
    -- 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
     

Share This Page