Automator or AppleScript Gurus?

For current or would-be users of Apple Mac computers, with answers to many FAQs.

Moderator: Moderators

Automator or AppleScript Gurus?

Post by BigRedX »

I'm looking to create a simple automation to on a key press will close the current Logic Song, switch to the Finder, highlight the next file in a list in the active Finder window (i.e. the equivalent of pressing the down arrow key) and then open it.

This sort of thing used to be simple to create in about a minute using the 3rd party QuicKeys utility. However that appears to be long dead. I had assumed that's because it has been replaced by AppleScript and/or Automator. However I can't work out how to do this with either of them.

My command flow would be something like this:

⌘W
"switch focus to Finder"

⌘O

Since Logic and The Finder will be the only open applications I could even use the keyboard command "⌘TAB" to switch focus to the Finder.

Other than that I need to be able to activate this script/macro from a key command within Logic.

Any ideas?
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by muzines »

Keyboard Maestro is the answer.

It's like QuicKeys, but way better, and can easily do this kind of thing (and is one of the many things I use it for.)

https://www.keyboardmaestro.com/main/

You could do some of this in AppleScript and Automator, but having walked a loooong automation path on the Mac, trust me when I say Keyboard Maestro is the tool for this kind of automation.

You can also trigger macros from key shortcuts, MIDI commands, and all kinds of other cool things. I trigger a lot of KM automations via MIDI too.

It's easy enough to figure out, but if you go that path and need help, give me a shout, I'm pretty experienced in this area. :)
User avatar
muzines
Jedi Poster
Posts: 11714 Joined: Tue Jan 10, 2006 12:00 am
..............................mu:zines | music magazine archive | difficultAudio  | Legacy Logic Project Conversion

Re: Automator or AppleScript Gurus?

Post by BigRedX »

Brilliant! Thank you!

AFAICS this works in much the same way as QuicKeys used to.

Off to download my free trial and then probably buy a copy.
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by muzines »

BigRedX wrote: Tue Sep 27, 2022 5:56 pm AFAICS this works in much the same way as QuicKeys used to.

Yes, I used QuicKeys back in the day, and it was good but got abandoned, and in the meantime KM has had another 10 or 15 years of development by a great developer and can do a lot more.

*Highly* recommended if you need a tool for automating things... :thumbup:
User avatar
muzines
Jedi Poster
Posts: 11714 Joined: Tue Jan 10, 2006 12:00 am
..............................mu:zines | music magazine archive | difficultAudio  | Legacy Logic Project Conversion

Re: Automator or AppleScript Gurus?

Post by BigRedX »

I've been a QuicKeys user since my Mac was running System 6 and it was essential for adding missing keyboard shortcuts to programs such as Quark XPress. However once Adobe started adding customisable shortcuts to all of Creative Suite it became less important and I stopped using it about 10 years ago when a Mac OS upgrade required a new version. By then I was only using it for a few macros and I decided I could live with a few additional keyboard strokes rather than pay £60 (IIRC) for the upgrade.

This new macro is going be essential for when my band plays live as it saves me having to squint at the computer screen (without my glasses) to ensure I have picked the correct next song to load.
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by BigRedX »

Well I've just spent 5 minutes creating the macro to do the action required in my OP. Appears to work flawlessly. I'll be trying it out under more realistic conditions at next week's rehearsal. Thank you!
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by muzines »

You're welcome! :thumbup:
User avatar
muzines
Jedi Poster
Posts: 11714 Joined: Tue Jan 10, 2006 12:00 am
..............................mu:zines | music magazine archive | difficultAudio  | Legacy Logic Project Conversion

Re: Automator or AppleScript Gurus?

Post by BigRedX »

Only negative thing I have noticed so far is that Keyboard Maestro appears to have hi-jacked Apple's ⌘ TAB command and replaced it with one of it's own that has smaller icons and different keystroke for stepping backwards through the open applications.

The changed interface doesn't bother me, but the changed key stroke does. Any ideas on how I can either turn it off or at least revert to the Apple ⌘ SHIFT TAB for moving backward though the open applications as it's one I use hundreds of time every day.
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by muzines »

I have that turned off too:

From the manual:

By default, Keyboard Maestro creates an Activate Application Switcher macro in the “Switcher Group” Macro Group, triggered by Command-Tab. You can disable this Macro by selecting the Switcher Group, then selecting the Activate Application Switcher macro and clicking the ✓ button below the Macros list. You can edit this macro to change the trigger to any other desired Hot Key avoid replacing the system application switcher.

https://wiki.keyboardmaestro.com/action ... n_Switcher
User avatar
muzines
Jedi Poster
Posts: 11714 Joined: Tue Jan 10, 2006 12:00 am
..............................mu:zines | music magazine archive | difficultAudio  | Legacy Logic Project Conversion

Re: Automator or AppleScript Gurus?

Post by BigRedX »

Sorted. Thank you.

So far everything else about it has been great. I've now recreated some of the other Macros I had previously been making do without - mostly ones for Acrobat.
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by BigRedX »

One final question.

Some of the pre-set commands conflict with my Adobe CC application's custom commands. So far It's been obvious what the replacements do and I have been able to locate and disable them. However I also sure there will come a point where I have no idea where to look for the command in Keyboard Maestro. Is there a way to search for a command by keystroke? I haven't been able to find how to do this.
User avatar
BigRedX
Frequent Poster
Posts: 1816 Joined: Fri Sep 03, 2004 12:00 am
RockinRollin' VampireMan

Re: Automator or AppleScript Gurus?

Post by muzines »

Yes, you can search by hotkey.

Here's three or four different useful options around this, including how to search by hotkey:
https://forum.keyboardmaestro.com/t/how ... does/26633
User avatar
muzines
Jedi Poster
Posts: 11714 Joined: Tue Jan 10, 2006 12:00 am
..............................mu:zines | music magazine archive | difficultAudio  | Legacy Logic Project Conversion
Post Reply