click url

ok i’ll get to the point. i have set up applescript to open IE (Internet Explorer) and go to a certin URL(we will call this url #1). and on the loaded page there is a blank page with nothing but a hyperlink(we will call this url #2). the hyperlinks url(#2) changes but goes to the same page everytime. so my question is, what script would i use to click that hyperlink (url #2) after i “Tell” IE to open the first page(url #1) without me manualy clicking it myself.

This is all i have:
tell application “Internet Explorer”
OpenURL “A url”
end tell

I just started scripting and i pretty much know nothing yet so your help would be greatly appreciated
Thank you, Matthew

Try this Matt,

tell application "Internet Explorer"
	set thisPagesCode to GetSource --get the source of the current page
	set startPos to (offset of "<a href=" in thisPagesCode) + 8 --add eight so it won't return the characters we are getting the offset of
	set endPos to the count of characters in thisPagesCode --get the count of characters from "<a href=" and the end of the file
	set listURLChars to characters startPos thru endPos of thisPagesCode --list every character from your start position thru the end of the code
	set quasiURL to ""--this should end up as our finished URL
--starting with what we know to be the beginning of the URL, start adding to our quasi URL until we hit the ">" character
	repeat with thisLetter in listURLChars
		if thisLetter as string != ">" then --if it doesn't signal the end of the url, copy it to our quasiURL
			if thisLetter as string != """ then --if it is not a quote, copy it to the URL
				set quasiURL to quasiURL & thisLetter as string
			end if
			exit repeat
		end if
	end repeat
	OpenURL quasiURL--have IE open the resulting url
on error--something went wrong, throw up a dialog
display dialog "You passed me a bad URL."
end tell

You’re better off using JavaScript via AppleScript:


thanks alot, i’ll try them out :lol: