Newbie : How to access widgets in a window?

I am trying to access a drop down menu in a window but I can not get my code to work. I would like to do something in the lines of:

get drop down menu 1 of front window

Any help would be appreciated…

A bit more info required, anulaibar;

What is the window; what application does it belong to?

If you just ask for the current application in a script running in the Script Editor, it will be “Script Editor”, so you have to specify “who” you want to talk to.

Where exactly is the drop down menu you want to address - is in on a browser page? Not all applications with drop down menus in their windows will necessarily call them the same thing, so be specific.

Thank you for your reply and I am sorry if I my question was unclear. The application I am trying to talk to is QuarkXpress and the window belongs to a custom made extension. But say for example that I would like to point to the first drop down menu in the window “Colors” that has the label “Show” and the value “All colors”. I first open the window by going to Edit->Colors or by pressing shift+F12 and then try to run my code:

tell application "QuarkXPress Passport"
	get the name of pop up menu 1 of front window
end tell

Any help is appreciated…

Here is the background to my problem:

The Quark extension that I am using helps a user to set a few parameters before saving a document. These settings appear as drop down menus in a window. Most of the settings stay the same most of the time. I therefore made a QuicKey recording triggered by pressing F1, that choose the right values from the drop down menus. Unfortunately this procedure stops every now and then. Sometimes it works perfectly, but at other times it stops with the message:

The shortcut “XXX” has stopped. Step number 7 named “Select A from Pop-Up Menu at 149 h 174 v” failed with the description: Could not select from pop-up menu.

The step at which it stops differ from times to times, so I am thinking that the problem has to to with picking the drop down menus by position. Since QuicKeys allows to pick by name too I thought I would give that a try. The problem is that I do not know the names of the drop down menus. Therefore I thought I would insert a step in the QuicKeys procedure that would look up the names through AppleScript which leads to my question: how do I write a piece of code that could do this for me?


pop up menu scripting in QuicKeys is rubbish.
It was never a problem in OS 9 but they are not able to fix it :frowning:

I usually work around this problem to use “Click at location” an then keystrokes with arrow keys to select the menu item

[Off Topic comment]

I’ll go one step further. QuicKeys for OS X (which I own, but have nearly phased out) is rubbish. In my view. The way to go is to spend $15 and buy yourself a copy of Daniel Jalkut’s FastScripts. This app replaces your Script menu with a new one that enables the assignment of hot keys to any script in any Scripts folder, is itself scriptable, and allows you to do all the things QK-X cannot by writing a small AppleScript to do it and triggering it from FS.

When I first started learning AppleScript a couple of years ago now, I was writing scripts (taking advantage of if-then-else functionality that QK doesn’t have) and shoving them as shortcuts into QK-X to get its hot key functionality. I was using QK because I had owned it and upgraded it from early in its existance pre-OS X. It simply never made the hurdle. I had a lot of trouble with some scripts working nicely from the Script Editor and failing in QK for reasons I couldn’t discover, so I gradually phased out all my QK scripts to AppleScripts in FastScripts.

Adam, I must contradict a bit. I’m also totally disappointed of QuicKeys X compared with the OS 9 version,
but regardless I use it very intensely. My main application, I work with professionally, is Finale by Makemusic which is actually not scriptable
(only the standard suite). I have more than 100 QuicKeys sequences for almost every case and I couldn’t live without it. You can work around
this stupid pop up menu bug and also the crashes when recording a sequence.

Doing this exclusively in AppleScript is rather impossible, it would be a hell of UI scripting :wink:

Ahh, Stefan;

I guess my viewpoint is “tainted” by the fact that I don’t use any applications on a regular basis that I haven’t been able to script somehow or for which I don’t have alternatives. I’ve stuck with QK up to version 3.1.1 and still have it in my menu bar doing a few things I haven’t bothered to script, but I don’t use it for anything “challenging”. Having said that, I’d have to add that I never use Automator either.

I use QKX shortcuts to call scripts that reside in my scripts folder hierarchy using QK script (text) shortcuts of the kind:

tell application "Finder" to tell (load script file (((name of startup disk) & ":Library:Scripts:Terminal scripts:scriptX") as string)) to GetFrontDoc(false, true) 

Other flaws in QK aside, this is generally working OK, even when these scipts are calling other scripts.
Adam, can you be more specific as to where QKX fails in executing scripts…?

Seeing as the topic has has changed to Quickeys does any one know how to import a Quickeys command from OS9 Quickeys to an OSX version?