I’m writing an AS to use Safari to open a page of a URL
On the page there is a “My Tools” menu, next to it is a “Add/Edit” menu, and next to that is a “Search” menu. In that “Search” menu is a drop-down menu containing some different ways to search the web site. I want to select the first item on that drop-down list.
I can’t seem to select the menu item on the URL, using:
get menu item 1 of menu item “Search” of menu bar 1
nor can I get it by:
tell application "Safari" to activate
tell application "System Events"
tell menu bar 1
tell menu item "Search"
click menu item "MLS # Search"
end tell
end tell
end tell
end tell
I can’t send you to that URL page because it requires a real estate license.
Menubar 1 is the menu bar at the top of your screen i.e. the one with the apple menu, the safari menu, file, edit etc. The one you’re talking about is on a web page in safari. It’s not a real menu bar like the real menu bar 1. It’s just a web page coded to look like it has a menu bar and therefore your attempts to use GUI scripting won’t work.
You need to script safari itself to access those choices. Keystroke commands using system events and gui scripting techniques won’t work. Safari accepts javascript commands and that’s probably the best way to do what you want. Unfortunately I’m not good at that so I can’t help but maybe somebody else can guide you.
Maybe if you search the forums for safari and javascript you’ll get some clues on what you need.