Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript Programming - on drop-down item

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/...op_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.

Posted on Jun 7, 2011 8:20 PM

Reply
3 replies

Jun 7, 2011 9:11 PM in response to andy8686

What you describe is not a menu in the raw sense of the word, it's just a javascript action that shows/hides page elements that are designed to look like a menu. Therefore you can't use AppleScript's normal UI actions to select menu items, which it what it sounds like you're hoping for.


All is not lost, though. Since this is just JavaScript, you should be able to invoke the browser's do JavaScript handler to tell it what JavaScript action to call. You just need to examine the appropriate JavaScript (that will be specific to the page you're looking at) to determine what JavaScript to call.

Jun 7, 2011 10:12 PM in response to Camelot

Thank for the help i think you have give me a direction on where i should work on. Another thing to check is that is this the correct way to activate the "do javascript" function


tell application "Safari" to activate

tell application "System Events"

tell process "Safari"

do JavaScript "(PLACE JAVASCRIPT HERE)" in window 1

end tell

end tell

Applescript Programming - on drop-down item

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.