Apple Script & Internet

I would like to view a series artist paintings on a website. I want to write a script that opens my browser, goes to the website, types in my user name, types in my password, types in the artists name, then uses the back button, type in another artist name, and continue to repeat the action of typing artists names, then using the back button. How do you get Apple Script to record functions like this? Is there a specific browser I need to use?

Try the following, it might help you.

You must have PreFab Player on your computer --(Available on this site I think)

Here is a method to search for a script in the scriptbuilder database.

tell application "Internet Explorer"
	Activate

	OpenURL "http://www.macscripter.net/script-builder.t"

	delay 5 -- I'm using a DSL connection so i put only 5 seconds

	tell application "PreFab Player™"
		set str to ""

		repeat 42 times --Here we have to press 42 times the tab button to be in the field
			set str to str & tab
		end repeat

		type str -- here is the string containging 42 tab chararcters

		type "My name is JB" --type in the field "My ame is JB"
		type tab -- selecting the search button
		type return -- clicking the serach button by pressing the return key
		type "(" holding command --going to the previous page
		type ")" holding command -- going to the next page
	end tell

end tell

There’s a couple easy ways you could do this:

  1. Send ‘do script’ javascript commands to Internet Explorer that fill out the form, submit it, pause, and then go back and do the next one.

  2. Use URL Access Scripting to submit the form directly, read the HTML code it returns, download and open the picture in Graphic Converter or some other picture application, then do it again for the next picture.
    What site is it that you wan to do this on? I don’t need the actual user name or password to tell you how to do #1. #2 would require you reading the actual picture page for the URL of the image you want to view.

I really should write up a tutorial on how to script IE to do these kind of things. It seems to be a recurring question here. OmniWeb and iCab have somewhat similar capabilities.
Then again, URL Access Scripting can do a lot of what people REALLY want, even though they don’t often know it’s possible. That would be another good tutorial. Hmmm, in my free time…

I don’t agree: MS have developed their own PPC infrastructure, which isn’t very Apple compliant (or was it the other way? bash them!), but the MS Mac development team has done an admirable job to hook this into AppleScript (praise them!).
At least, it is possible to get/feed URL’s into Explorer, I think the syntax is:

tell application "Internet Explorer" "OpenURL theURL "
resp.
"set ow to ListWindows"
"set currURL to item 1 of GetWindowInfo (item 1 of ow))"
"set currWdName to item 2 of (GetWindowInfo (item 1 of ow))"

Yet you may have to dig into VisualBasic and other MS stuff to get buttons clicked, I have never done that.

Eelco Houwink

Nope, you use Javascript, which is fairly open and useful. Basically, almost anything you can do as the web-authoer, or as a web-surfer, you can tell Internet Explorer 5 to do automatically, using Javascript.

The ‘do script’ command in IE5’s dictionary allows you complete control of IE. If you learn some basic Javascript, you can use IE to fill out forms, lookup information…anything.

Not that I love IE - in fact, I normally skip using any web browser at all, and just do the job with URL Access Scripting, which can POST forms and read the resulting page.