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 mail.yahoo.com
  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.

Thanks,
Swapnil

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

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

PS2!
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"
	activate
	make new document
	set URL of document 1 to "https://login.yahoo.com/config/login_verify2?&.src=ym"
end tell

delay 3

tell application "System Events"
	tell process "Safari"
		keystroke "your@email.com"
		keystroke tab
		delay 0.5
		keystroke "your_password"
		delay 1
		keystroke return
	end tell
end tell