New to Programming - is this possible?

Discussion in 'Mac Programming' started by BounceTigger, Mar 21, 2008.

  1. macrumors newbie

    Joined:
    Mar 21, 2008
    #1
    Hi all! I'm looking for a script either through Automator or Apple Script - but I'm not sure if the following script is too complex:
    Essentially, my wireless connection requires me to enter a numeric password (lets say its 665544) to get on the internet. When I launch Safari, it redirects me to a welcome page. On the page I click a link that says "Enter password" and then enter the password in a textbox.
    So, in English terms, I want to run the following:
    Open Safari
    Click "Enter Password"
    Enter 665544
    Click "Enter" (or just press return)

    Ideally, I'd like to run this at start-up, but I'm fairly certain I can just throw it into "Log-in items."

    Is it possible? And, if its not too difficult, could someone write it for me?
    (I'm running 10.5.2 if that matters)

    Thanks so much!
     
  2. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #2
    Hi

    If your router is using a simple post for the password screen, then you will be able to use Automator. All you need to do is set up an action that passes an url to Safari which is the same as the one generated from clicking enter on the router's password screen. For example it might be something like this:- http://192.168.2.1/login?password=665544. Have a look at the html source and look for a form element to see what attribute names it uses.

    Hope this helps!

    b e n
     
  3. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    As lazydog said, it's really all in how it works. If you can figure out what GET/POST string is sent, it should be trivial. You should even be able to make a shell script that runs on startup that's a one liner, such as:
    Code:
    curl http://192.168.2.1/login?password=665544
    To decipher what the address should be, on the page you enter the password there should be a form element that has a target attributed. That target is the page that the information will be sent to. It will also have some sub-elements called input. Each of those input elements can be added to the query string, along with the values you would enter in the field. If you need help, perhaps you could post the form element and everything inside of it, and we could help you craft the string. obviously you should not send the actual password, etc. but we should be able to point you in the right direction.
     

Share This Page