Menu Item and Menu Bar Item help

Hi,
So basically what I need is my script to do is select the open tabs option at the bottom of a series of menus. For whatever reason, I can’t get it to work and I’m sure its simple but…


tell application "Safari" to activate
tell application "System Events"
	tell menu bar 1
		tell menu bar item "File"
			tell menu "File"
				tell menu bar item "New Window"
				end tell
			end tell
		end tell
	end tell
	
	tell process "Safari"
		tell menu bar 1
			tell menu bar item "Bookmarks"
				tell menu "Bookmarks"
					tell menu item "Bookmarks Bar"
						tell menu "Bookmarks Bar"
							tell menu bar item "Classical"
								tell menu "Classical"
									try
										menu bar item "Open in Tabs"
									end try
								end tell
							end tell
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell


here’s another way, but i copied the second half from the UI Browser and still no luck.


tell application "Safari" to activate
tell application "System Events"
	tell menu bar 1
		tell menu bar item "File"
			tell menu "File"
				tell menu bar item "New Window"
				end tell
			end tell
		end tell
	end tell
	--copied this part.
	click menu item "Open in Tabs" of menu 1 of menu item "Classical" of menu 1 of menu item "Bookmarks Bar" of menu 1 of menu bar item "Bookmarks" of menu bar 1
end tell

also, is there a way to toggle between specific windows in AppleScript?
Thanks!

Hi,

you have to target the process “Safari” and use the keyword click.
Try this:


activate application "Safari"
tell application "System Events"
	tell process "Safari"
		keystroke "n" using command down
		tell menu item "Bookmarks Bar" of menu 1 of menu bar item "Bookmarks" of menu bar 1
			click menu item "Open in Tabs" of menu 1 of menu item "Classical" of menu 1
		end tell
	end tell
end tell