A Few Questions Before Digging In

Ohh. When you said that, I thought you meant moving the window manually with the mouse, because KM doesn't have any "commands" it has "actions." I guess we'll check that up to misunderstanding. Let me reconsider that, then.

As for GG's macro, I'll let him troubleshoot that with you.

If you say Spotlight isn't responding to the move window command, I will believe you. Although I don't know how to fix that, or if it's fixable, there is a workaround. You can probably do this workaround in a single statement. Basically you use the Click and Move Mouse KM action to click on the Spotlight magnifying glass on the screen, and drag it to the new location.

Would you be happy with this workaround, or would you only be happy with getting the Move Window action working?

This will move Spotlight to the centre of the screen, not accounting for its width.

image

@Sleepy , I appreciate the response and will it a go.

I will admit that while I remain enthusiastic I have run into a number of problems with KM that I do to know how to solve without using AppelScript which defeats the purpose. This is particularly true given most of the AppleScripts I tried work as standalone AppelScripts but do NOT within KM.

With a little luck others will be able to help me.

Thanks.

Sure thing. My knowledge of AppleScript is limited. I'm not sure if I agree or disagree with your idea that "if it requires AppleScript, that defeats the purpose." You could also say the same thing with shell scripts, like, "if it requires a Shell Script, then that defeats the purpose." But I don't think it's the job of KM to duplicate all shell commands. KM does duplicate a handful of shell commands, but it's not a 100% perfect duplication.

I'm surprised that you asserted that "most of the AppleScripts you tried work as standalone AppleScripts but not within KM." I didn't know that was even possible, let alone common. Obviously you know more than I do about AppleScripts.

Hi @Joel - you’ve been asking for examples of how to do stuff with KM so now I’ll ask you to provide examples of those AppleScripts you say don’t work in KM so we can see what you’re trying out, especially given that you’re new to KM. Of particular interest is how you’ve embedded those AppleScripts in KM.

@Sleepy with KM goes simply everything :wink:

2021_12_12_Support_1

I have contacted @Joel via a DM and will explain how to create the KM macro.

It could be that an important setting/requirement for the execution of the AppleScripts in KM is missing :thinking:

1 Like

Hey Joel,

That's because @gglick tried to use a range with negation to try and negate a literal string, and it doesn't work that way in regex.

I've made that mistake myself, once or twice...

This does work – and I’m even escaping any possible regex metacharacters in the window title.

Minimize All Windows Except The Front One v1.00.kmmacros (5.3 KB)
Keyboard Maestro Export

The regular expression here is complex using negative-lookahead and beyond most normal users, but you can quite easily:

  • Get the window count (not obvious how).
  • Loop through and minimize by window index.
  • Ignore window 1.

Note – I personally would not give up Moom for Keyboard Maestro. I like Moom and use it along side KM for what it's good at.

-Chris

2 Likes

@Sleepy, many thanks for your continued assistance. As a newcomer to this forum I am restricted to one post in teh first 24 hours. I will be posting a separate thread on the problems that I have encountered with AppleScript hopefully this will help.

I do hope to get KM sorted out as it looks very powerful for now I am stuck all over the place.

Thank you.

@tiffle, many thanks for taking the time to respond, it is greatly appreciated!

As noted in my immediate preceding post, as newcomer to this forum I am restricted to one post in teh first 24 hours. I will be posting a separate thread on the problems that I have encountered inclusive of the macros as soon as I am allowed. They are all teed up and ready to go.

Thank you.

1 Like

@ccstone : Christopher, I thank you for the macro but it did not work for me. When I tried to run it I got the following notification:

Screen Shot 2021-12-12 at 9.20.08 AM

And yes, I did have a number of windows opened.

Would greatly appreciate any assiatnce you can provide in getting this going.

Chris, that is my thinking for now!

Ahhhh, dumb question! Is there a way to print a macro so that I can look at while creating other macros and use it as a guide to make sure things are consistent and properly done?

@Joel in the following example the window in the foreground (here Drafts App) is moved to the center and all other open windows are hide.

2021_12_12_Support_1

Windows Hide others <0D61 211212T155855>.kmmacros (2,5 KB)

Windows Hide others <0D61 211212T155855>

In the first action in the macro you can adjust the individual window positions under "Center".

Not sure if this will help but you can have more than one KM editor window open at any time - just use File>New Editor Window from the KM menu, or shortcut ⌃⌘N

Here's how I enter the 1Password master password (note that it doesn't launch the app; I have another very short macro to do that). There may be better ways, but this works for me.

image

Master Pwd.kmmacros (153.8 KB)

1 Like

@Joel here is an example how you can open different apps with only one shortcut. Since I also use Moom, I added an AppleScript at the end of the macro which rearranges the windows of the opened apps.

2021_12_12_Support_2

Open Apps : Moom <96FE 211212T163803>.kmmacros (9,1 KB)

Open Apps : Moom <96FE 211212T163803>

I stand by the Moom app like @ccstone, especially when I rearrange windows, the quick snapshot function is unbeatable good :wink:

1 Like

Here's another method to minimize all windows except the front that may be a little slower, but should also be more reliable:

Minimize All Windows Except Front.kmmacros (2.2 KB)

@ccstone Thanks for providing an alternative regex method, Chris! I did know I was technically negating a range of characters rather than an actual string with the method I used, but it worked in my (admittedly limited) tests, so I thought I would give it a try. Regardless, I'm happy to have a more robust way that works as intended with strings for future reference.

1 Like

@RickO my KM macro is not quite as long as yours. However, it works fine.
However, I secure the autofill logging process with a pushover notification that I subsequently receive on all  devices.

You never know :wink:

Video

https://d.pr/v/7OrOf4

TestPW <EA81 211212T170905>.kmmacros (6,1 KB)

TestPW <EA81 211212T170905>

The macro also serves me well with every request to enter my admin password.
It has saved me a lot of work after Clean Installs.

Video

https://d.pr/v/sbQn3U

TestMac <C5F9 211212T171631>.kmmacros (37,2 KB)

1 Like

Cool. How do you trigger this (your example has no triggers showing)? If by keystroke, I guess the big difference in mine is that it automatically recognizes if the 1Password master password is needed whenever 1Password activates.

I wasn't familiar with Pushover, but I looked it up. Cool tool for a very reasonable one time cost. Too bad it doesn't have Alexa integration though. How do you do the KM macro action for it? I don't see that as an option.

1 Like

@RickO I use a different KM Autofill macro for 1Password to unlock apps, files, etc.
When the login window appears, the 1Password Mini is called with this shortcut:

2021-12-12_18-07-25

Then my macro checks if the 1Password Mini is unlocked or not. If the 1Password Mini is locked, the macro pauses until I unlock it via the Keychain Autofill macro.
I use, as shown in the video, a BetterTouchTool gesture... if you have no Touch ID, then you just tinker with your touch yourself :wink:

You can find a video and a screenshot of such a macro in this post:

Pushover notifications can do more than just display.

In the following video you can see my workflow:

Video

If I log in, I get the Pushover notification and can trigger a photo via the FaceTime Camera using a Siri shortcut (iCloud Drive).
I receive the photo again via a notification. If someone is sitting there at my Mac, who does not have permission to do so, then I can again execute a Siri Shortcut, which locks my keyboard and triggers a shrill alarm.

Also works if you trigger it when you wake up your Mac, of course. In my office, no one goes to my Mac anymore :wink:

There is such a pushover plugin for KM:

13)Pushover Blanko : Website <434C 211212T183457>.kmmacros (44,1 KB)

13)Pushover Blanko : Website <434C 211212T183457>

In the macro you will find the link to download the KM plugin.

I also use the Pushover notifications for Siri shortcuts. Here is a link to a template for it:

Pushover Siri Shortcut

https://www.icloud.com/shortcuts/95e6baa9ed5e4e1490ad03b38825a2e5

Would you like to have an indication of the battery level of your mouse, trackpad or MBP? You want to know that the battery level of your devices has dropped below 10%?
The popular apps only show you the notifications on the Mac, but thanks to Power Manager, KM and Pushover, I now know at all times, even when I'm not at home.

https://twitter.com/myapfelworld/status/1334421034792005634

https://twitter.com/myapfelworld/status/1418697431945027588

1 Like

@appleianer, I thank you.

I note that the macro hides windows rather than minimizes windows and these are different and thus will not work for me. I need to minimize windows.

Specifically, "minimize" minimizes the program to the dock where you can see a thumbnail of the program's window. while "hide" hides the window without adding the program's thumbnail to the dock.

Thanks.