Need some help with scripting IE on mac osX

Hi i need some help on scripting IE. In haven’t been scripting for long, about 3 days, bujt i would like to know whether and how it is possible to open IE and goto a URl.

I am also curious as to wether you can “click” buttons with scripting and wether you can address textfields and edit them.

so for an example if i was to script me to be able to open hotmail and log in:

could i open IE and gotot
then insert my username into the textfield
then password
then get the script to “click” the log me in button.

Any ideas on whether this is possible???

Follow this thread:

If you find any difficulty (if you don’t know a bit of javascripting you will) come back here with some additional questions…

Good luck! :wink:

I have read the post but still get a bit confused. I dont get how the javascript clicks the button.

Also how can i store the filename as a variable.

as i want to reference that filename agaiinst excel to search the columns.

Now I am confused… Isn’t this a thread about IE? (curiously, I’ve been reading your thread about excel, but I’m not an excel expert, so I skipped it) :wink:

It is yes but it also ties in with a few things.

Here is what i really want to do, all of it.

open an image in photoshop,
get the filename and store it to a variable say currentDocument,
Then get the caption, which is stored in the file ← this bit i know how to do

Then i would like to be able to open excel and search a list using the already saved document name, to get a unique number, that then has to be saved under uniqueNumber

After all that i would like to open IE and then edit a form, i do understand you JS now, didnt read it properly, brain is fried.

All this will be in a for loop which i will get too once all of the above is finshed.

This is to help the office upload pictures to the net which at the moment is wellllllllll slow, so i am hoping to get all this done so that it is all automatic leaving time to be spent twidling thumbs, as you should at work.

Keeping away the Excel question…
You can click a button in IE using javascript’s methods. And IE’s applescript dictionary allows you to execute javascript code through the “do script” command.
To understand how does javascript clicks the button, you should learn a bit of javascript, or be a bit of intuitive… (if you’ve been programmer of any kind, you will understand quickly).
JavaScript’s DOM (Document Object Model) defines some objects and its properties. One of its objects, “window”, contains “document”, which contains “form”, which contains “elements”, which own properties and accepts events.
So, this code:

tell app "Internet Explorer"
     do script "window.document.forms[0].submit()"
end tell

If you have opened “” before running this code, then it does mean “submit first form of document of window”.
And this one:

tell app "Internet Explorer"
     do script "window.document.forms[0].elements[4].value='whatever'"
end tell

Means: set value of element 5 of form 1 of document of window to “whatever”

Maybe, if you provide a link to some page of your interest, we can work over such page, and study its forms and elements…

i have done some programming, and i get what you mean, is there a api documenation website for javascript olike there is java???

The form i am going to fill in is strange, it is done in asp and i didn;t know if i could do what you suggest.

I will post a url for a screen shot and u can see what i mean, i would poist the url butr its on a secure site and i cnt really p[ass that out as i expect you understand.

thge url for the picture is thus:
^-- this will have to be cut and pasted, it doesnlt work as a link for some reason

I see… (geocities doesn’t allow hotlinking)
This should be very simple (though I can’t see the code of the webpage).

tell app "Internet Explorer"
     do script "with(document.forms[0]){ // with first form
     elements[0].value = 'whatever'; // library number
     elements[1].value = 'whatever'; // physical location
     // ... more stuff
     submit(); // submit any changes
end tell

It doesn’t matter if it is programmed in asp, php, perl or whatever, since FORM objects are owned by the web page, and have allways the same structure:

<form name="whatever" action="whatever.cgi" method="post">
<input type="text" value="000056-ovw.jpg">

You can try this… Let us know!