I'm trying to write a macro to trigger the "Right Size This Column" contextual menu item that pops up when you right-click the grab handle at the bottom of the divider between columns in a Column View Finder window.
I'm not having any luck. I did have a macro working that found the image of the grab handle on screen and then right-clicked that mouse location to trigger the contextual menu. It's not working any more and no amount of playing with the image or the resolution slider has made it be able to find the image.
I tried looking in the Accessibility Inspector to see if I could find the UI Element and then trigger that with a System Events AppleScript. No luck that way either.
Does anybody have an idea of how to trigger an item from this contextual menu with Keyboard Maestro?
I’m going to partially answer my own question… It turns out that I had enabled the Increase Contrast option in System Preferences > Accessibility > Display (because I like how the display looks better that way). But it also turns out that this seems to mess up KM’s ability to detect images on screen in certain cases. After deselecting the Increase Contrast option and tweaking the image resolution, I was able to get my original macro to work again (most of the time).
I’ve still had no luck finding a non-image way to trigger the Right Size popup menu.
Here's the macro I'm using. It works pretty well as long as you don't have Increase Contrast enabled in Accessibility. You would likely have to re-take and crop the screenshots (in two macro steps)and adjust the sensitivity for your monitor. I also trigger this macro from other macros I've set up that move a finder window to the top or bottom half of the screen and put it in column view.
I created a macro very similar to this to right size all columns. It works great with a hotkey but I recently decided to take it a step further and remove the need for a hotkey altogether.
I ran into a few issues and backtracked and then branched the idea in two directions.
In all I now have three macros. One is similar to the macro above. When pressing a hotkey while Finder is active KM searches for the divider image and option double clicks but I haven't needed the pauses.
The next macro is "Auto Right Size All Columns". This macro runs when Finder is active and repeats every 1 second. It first gets the current finder selection and puts that in a variable. If the selection is a folder then it compares that variable with and 'old' variable which contains the previous selection (from 1 second ago). If they are the same, then nothing happens. If they are different, then the right size macro is triggered and the old variable is updated to match the new selection. Since this is only triggered when a folder is selected the file previews column is not minimized and will take up whatever space remains in the window.
The third macro is a simple toggle for the auto feature. Assign a hotkey and toggle the state of the auto macro.
I will say, however, that I've abandoned my right-size macro after having found Total Finder (https://totalfinder.binaryage.com). For $12, it automatically adjusts column widths within min/max limits, colors the text of icons with tags and some other stuff. Works more reliably than my macro ever did.
Total Finder for Mojave requires that you disable SIP. Not a big issue for me per se, but having macOS running in a non standard way usually leads to problems. If nothing else forgetting that it is non standard and something else doesn't work.
Why should this be so hard? Should be Finder setting.