Long delay in UI script

I have a “Logins” folder in Safari’s bookmark bar that contains several items. I want to select an item from this list by using a keyboard shortcut rather than the mouse. I will use a different shortcut for each item in the list. The script below (for item 2 in the list) works, but there is a very long delay between the click and the keystroke commands (on my machine 5 - 10 seconds).

I would appreciate it if someone could tell me why the long delay and whether there is a faster way?


tell application "Safari"
	activate
	tell application "System Events"
		tell process "Safari"
			tell window 1
				tell group 1
					tell menu button "Logins"
						click
						-- long delay here 
						keystroke (ASCII character 31)
						keystroke (ASCII character 31)
						keystroke (ASCII character 13)
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

Carl

Model: iMac 2011
AppleScript: 2.1.2
Browser: Safari 533.21.1
Operating System: Mac OS X (10.6)

I’ve tested the code an came to the same conclusion: Only group of bookmarks (not a single bookmark) in safari’s bookmark bar gives this problem. Doesn’t matter if you use click, click at location, perform action “AXPress” or perform action “AXShowMenu”. Mouse tools can help you, but the disadvantage is the cursor of the mouse will also be moved to the position.

OK, I was afraid that was going to be the answer. Thanks for the effort.

Carl