Is this possible?

Is it possible to program an applescript to press a specific button of a specific website? And if so, how do I do this?

cheers,
denns

It is possible if you use Apple’s GUI scripting or Extra Suites from http://www.kanzu.com That said, it would be fairly unpredictable especially if you plan to distribute the script.

Follow this thread and you will find some additional help:

http://bbs.applescript.net/viewtopic.php?t=3986 :wink:

I’ve followed the threads regarding javascript and I found a javascript that automatically does a search pattern for ‘applescript’ on the macscripter.net forum. Only problem it’s for IE. Let me explain what I need. I am trying to access the site ‘https://grc.com/x/ne.dll?bh0bkyd2’. But everytime I access it via an applescript I get a ‘…because of security implications your browser is not aloud to reload the page (paraphrased)’. What I want is to be able to load this page anytime I want; and not to get this error. I think it’s possible, thru a javascript, to press the button (on the GRC website) to activate this feature. However I don’t have the programming smarts to do this at this time. Any suggestions would be appreciated.

cheers,
denns

This line of code opens the URL everytime for me…

open location "https://grc.com/x/ne.dll?bh0bkyd2"

I have given the wrong address: here’s the new one ‘Shields UP!! — System Error’. It allows you to load once (I think) and then the security error comes up. If I go to ‘GRC | ShieldsUP! — Internet Vulnerability Profiling  ’ and press 'All Service Ports" button it works fine.

cheers,
denns

Does the part of the URL after the question mark change from one visit to the next? It might be some type of authentication mechanism.

No it doesn’t. When I press the ‘All Service Ports’ button this url comes up ‘https://grc.com/x/ne.dll?rh1dkyd2’ and the page loads properly. The numbers after the ? always seem to stay the same although I havn’t checked more that 4 times ion a row. When I use the same url as per your example ‘open location "https://grc.com/x/ne.dll?rh1dkyd2’ a browser suppress page is loaded.

cheers,
denns

Let’s go:

tell application "Internet Explorer"
	do script "document.forms[0]['7'].click()"
end tell

If you control-click the image “All Service Ports” and pick “open image in new window”, you will see its name in your location bar: “pa_asp.gif”.
If you control-click the page and choose “see code”, you can search for “pa_asp.gif”, and you will see that this is a “input type image” within the only form in the page. Its name is “7”. So:
document.forms[0][‘7’] // equal to
document.forms[0].elements[5] // 5 = index of input-type-image in the form
click() // that is, a click

Thanks JJ for the code. Can we change it so it works in Safari?

cheers,
denns

I think we can’t. Unfortunatelly, Safari’s javascript engine is not a finished work, and js-applescript support is a work in progress… Anyway, if you wish take a look, it’s easy:

tell app "Safari"
     do JavaScript "whatever" in document 1
end tell

You can also try Omniweb, which recently implemented this feature and has a similar syntax…

Thanks JJ for the help.

cheers,
denns