Creative Input: Bring an AppleScript-less Window to Front [SOLVED]

I have an app that has no AppleScript dictionary. It also has no File or Windows menus either. I think this is the reason I can not bring one of it's windows to front (either by name or index).

I can refer to windows by name in IF statements, and move them, click in them, etc., but so far the only method I have come up with to bring a window behind another to the front is to minimize/unminimize it.

Any ideas?

Hey @ScottinPollock,

What's the app?

-Chris

Hey @ccstone,

It is Lumix Tether… a tethering app for Panasonic Lumix GH5 and G9 cameras.

Nevermind... figured it out.

It is always best to post the solution even if you just figure it out yourself - that way it is documented for the next person with the same problem (and in my experience, “the next person” is often yourself several years later when you've forgotten that you solved the problem previously).

1 Like

I just used an Until to repeat ⌘-` until the correct window was front.

Hmm... Looks like it's tied to a camera and can't be opened as a demo.

Try variations of this AppleScript (changing the window name or index number as necessary).

tell application "System Events"
   tell application process "Lumix Tether"
      tell window "WindowName"
         perform action "AXRaise"
      end tell
   end tell
end tell

Experiment in the Applescript Editor.app until you get something working, then you can move on to a Execute an AppleScript action.

Make sure the process name is correct.

You can run this to see them in the Applescript Editor:

tell application "System Events"
   name of application processes
end tell

-Chris

Yeah… without a connected camera you won't have access to the windows that need to be managed.

But thanks for this… it works a treat, although it is actually a little slower to bring the wd to front than my hacky solution above. Nevertheless I will use it as it is a more direct/reliable solution and speed isn't all that important.

Thanks again.

Chris,

One more question if I may… I scrubbed through a lot of AppleScript looking for this. How would one know the AXRaise action even exists?

Hey Scott,

You have to know about System Events – and you have to be know about UI elements – and you have to know how to find out whether UI elements support actions.

Run this in the Script Editor.app to look at System Events' scripting dictionary:

tell application "System Events"
   set sevApp to path to it
end tell

tell application "Script Editor"
   activate
   open sevApp
end tell

Run this with at least 1 window open in the Finder to get a quick glimpse of discovering actions:

tell application "System Events"
   tell application process "Finder"
      tell window 1
         actions
      end tell
   end tell
end tell

I bought UI Browser about 15 years ago to help me with the mess that is UI-Scripting on the Mac.

It's about $55.00 U.S. and has saved me much frustration.

I also use Script Debugger ($99.00 U.S.), and it too has features that make discovering the Mac UI easier.

In addition to making AppleScript MUCH easier to write and debug.

Searching Google for AppleScript bring window to front I very quick got to this:

But then I know what I'm looking for.

This is a bit out-of-date, but give it a look:

REFERENCES FOR LEARNING & USING APPLESCRIPT

-Chris

I did look in the system events dictionary, but AXRaise was nowhere to be found. But asking the element for actions is what I was missing.

Thanks once again!

1 Like