Cache the progress of a KM macro!

Hi,

...ForkLift 3 and 4 have a very convenient Workspace saving and calling function. I created a simple macro that reconfigures the Finder's foreground window on demand with specific tabs and display modes, regardless of the state of this window in terms of number and display quality of the tabs.

KM is really very appreciable for this kind of manipulation (thanks again to the developer...), especially since the macro “never” makes an error against ForkLift which does not respect certain settings (in addition to 'a version 4 which is obviously not yet finalized).

The speed of completion of the KM procedure obviously depends on the number of tabs before the macro is called, but the macro goes very quickly, without having to insert pauses between the instruction blocks, nor for that matter mouse click. It is built solely with tests in the Finder menus and a bit of AS code.

It's perfect!...Thank you again Peter.

I was wondering if it was possible in the current state of KM (version 11) to cache this type of macro?...

The system takes some time to refresh the window, changing the tab display. Would it be possible that in the background KM “freezes” the state of the Finder window before launching the macro, applies the processing in the background, then, finally “unfreezes” the window to display it in its final state. Thus, we could imagine a macro “rendered” even more quickly and better visual comfort for the user.

What do you think?... Or is my question stupid?... :wink:

One thing that may speed things up slightly is converting your text AppleScripts to precompiled .scpt files. I built a tool for this purpose:

I would also recommend combining the last two scripts into one. You can use the following for the & keypress:

tell application "System Events"
    key code 26 using {command down}
end tell

Thank you Noisneil for your feedback.

Your conversion script is very, very practical: for the small script of my macro, the conversion does not bring a sufficient gain, but a very real one. I think that for heavier ASes, the gain must be greater.

Finally, concatenating my last two AS by inserting the call of a keyboard command (key code 26 using {command down}) causes the broadcast of an audible alert (Gong).

:wink:

Thanks again!...

Show me the newly combined script.

Here is.

I feel like this could be simplified but my French isn't up to scratch so I'm not entirely sure what it is your'e trying to do. Is it simply to open some Finder tabs?

Here's how I would do that:

Open Paths in Finder Tabs.kmmacros (44 KB)

Macro screenshot

“Is it to simply open some Finder tabs?”
Yes, absolutely and since I'm not an expert in AppleScript, I found this script on the net and copy-pasted it for my own needs. Maybe it doesn't quite fit after all, but it works...

Thanks for the macro “Open Paths in Finder Tabs.kmmacros (44 KB)”... But it seems much more complex to me. I'm going to try it anyway...

It's far more versatile as you can add as many paths as you like. :+1:t3:

“It's far more versatile as you can add as many paths as you like.”
Perfect Noisneil!...

1 Like

macOS doesn't offer any real way to do background updates to the GUI. The only way I could conceivably think of to freeze the Finder windows would be to sleep Finder's process … but if it's sleeping, you can't interact with it, so you can't make those changes.

Technically, I don't think this is something Keyboard Maestro could do, and I know it's not something it currently does.

-rob.

Thanks Rob... Probably a question that's a little too naive on my part (I'm just a simple user)...

In theory you can make it less visually jarring by either (both) making the window tiny until all the tabs are added, then resizing to where it was, or move the window down until just the header bar is onscreen and then move it back up when done. That way you wouldn't really see most of the updating taking place.

KM can do all of those things: You'd get the windows current size and location and save it to a variable, then add the actions to move/size the window, run your macro, then restore the size/location using the saved information.

-rob.

“In theory you can make it less visually jarring by either (both) making the window tiny until all the tabs are added, then resizing to where it was, or move the window down until just the header bar is onscreen and then move it back up when done. That way you wouldn't really see most of the updating taking place.”

Rob, that's an idea to try.

I had previously imagined for the same result to simply close the foreground Finder window, then recreate one with the tabs I need. It was a little too “violent” visually, hence the idea of keeping the same window and rearranging the tabs...