Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andy8686

macrumors newbie
Original poster
Jun 7, 2011
1
0
I just started learning Applescript programming. I need to write an Applescript program to enable the drop-down of the menu and clicking one of the item in the drop-down.

Example of the drop-down menu: http://javascript-array.com/scripts/simple_drop_down_menu/#
For example, I need to click the DHTML menu in Home. (Applescript to let Home auto drop-down and Auto click on DHTML)

Please guide me on how should i write this program and if possible do give me a sample Applescript coding so that i am able to reference to.
 
Last edited:
If you are looking for a way for AppleScript to interact with a web page, that can't be done (in a practical sense). AppleScript does its magic by sending AppleEvents between applications. You can control Safari by telling it to open a new tab, what address to load, make a PDF of the page, etc. But you can't interact with Javascript on that page.

Now, I don't give up easily. If I was bound and determined to get something to work I would have AppleScript tell Safari to load the page, then tell Safari to give me the page source and then parse through that looking for the event that happens when I click a certain item. That may cause another page to load, which I would tell Safari to load for me. Etc.

It's the long way around and isn't exactly suited for AppleScript's strengths, but it could be done.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.