Script to login into a mail account

I am trying to write a apple script that would automatically log me
in to my mail box like yahoo or gmail etc… Here is what i want to do :

  1. Open Safari
  2. Goto location
  3. Enter username password into the fields,and click on login (this
    step is one which i am not able to figure out )

is it possible to do step 3 ? if yes can you please guide me through
it ? i tried to read all the tutorials but there was no one which explained
something like this.


I’ve wrote a simular script, so you might try this.

Make sure to click the checkbox labeled “Enable access for assistive devices” in the Universal Access System Preference pane to enable GUI scripting.

The delay times are individual, depending on how fast your Mac is, and how fast your internet connection is. Go figure what’s the best delay time for your script on your mac… :slight_smile:

tell application "Safari"
	make new document
	set URL of document 1 to ""
end tell

delay 3

tell application "System Events"
	tell process "Safari"
		keystroke ""
		keystroke tab
		delay 0.5
		keystroke "your_password"
		delay 1
		keystroke return
	end tell
end tell