Script to get Safari to autofill a form

I’m back with question number two…

On to internet connecting…

Is there anyway to have apple script (open safari to a certain website, auto fill the form-this I can do so far) and 'hit enter" to send the form data. I want to use this to check my stocks, and web based email. It’s the clicking the button after the form is filled that I don’t yet know how to do, or if it’s even possible. I used to use quick keys for this. Anyway, the goal of this script is to run at startup, so I can go get my coffee and do other misc things and return to the comp with email open, and stock account open as well.

Thanks in advance for any and all help.


Which version of OS X are you running? Do you need to click a button on the web page or simulate hitting the enter key on the keyboard?

– Rob

i’m using 10.3.2, haven’t installed the 10.3.3 update yet.

I need either to simulate a mouse click, on a button, at a set location…which I think may be more complicated by the fact that when the safari window is opened it changes position depending on if other windows are open. After auto fill fills out the form, I can manually hit enter or return and it sends the form, so coding a keystroke of return or enter will do the job, too.

I’m basically looking for the more simple of the two when it comes to programming them.

I would assume that to do a mouse click I would need to set the position of the safari window first, unless it’s possible to figure the mouse click position within the safari window.

Thanks again for the help.

ben c

Simple to most of you I’m sure, but I’ve figured it out by looking at a post that wasn’t really related to this at all…so here’s the code for those of you who may not know…

this goes to my ameritrade account, auto fill feature in safari fills in the name and pw, and this hits the return key.

The delay is in the code because sometimes auto fill takes a few seconds to fill out the form, 10 is plenty.

thanks anyway to all

ben c

tell application "Safari"
	make new document
	set URL of first document to ""
	delay 10
	tell application "Safari" to activate
	tell application "System Events"
		tell process "Safari"
			keystroke return
		end tell
	end tell
end tell