Hold a key for 1 second

Demo

Hi

I used to have a macro that copy and move items from a subfolder to a parent folder (no navigation required) using the default copy shortcut [Command+C], but it only works If I release the [Command] key and hold the [C] key for a second (it would play a tone to let me know that I can release the [C] key). * If I release both keys - or release the C key in less than a second - It would only copy items.

I could use another shortcut, but why not use available shortcuts to do more than one function? It’s easier to remember. The only difference is the holding time.

  • KM version 11.0.1 on macOS Sonoma 14.5.

I mean, you could always write a macro that literally moves a selected file in finder to it's parent folder.

Move to parent.kmmacros (3.8 KB)

You could modify it to move all 'selected' files as well:

ALLFILES=`pbpaste`
while IFS= read -r line; do
	FILEDIR=`dirname "${line}"`
	FILENAME=`basename "${line}"`
	cd "${FILEDIR}"
	mv "${FILENAME}" ..
done <<< "${ALLFILES}"
1 Like

Thank you for you fast response.

Your suggested macro requires a different shortcut — I’m using the following simple macro temporarily, which also requires a different shortcut.


Move to parent.kmmacros (2.3 KB)

  • For this macro to work, the items must be displayed as a list and the subfolder must be expanded — I usually move items to parent folders at front. Both macros fulfill this objective but yours can do more.

What I’m looking for is a way to merge two shortcuts.

  1. [CMD+C] to copy items.
  2. A long-pressed [C] for an assigned time of my choosing to do other things, like moving copied items.
  • The shortcuts can only merge when I release the [CMD] key and keep holding the [C] key for the assigned time. (If I release the [C] key or both keys earlier, the second shortcut will not be executed, which is the point, because I want to be able to use the copy shortcut when needed.

You earlier said "a second" -- about the time for a "long pressed" hot key trigger. You won't get the "beep" you asked for, but it's easy to get the feel for how long a long press should be. Release the C key in under a second and you'll get the "normal" ⌘C shortcut.

Otherwise, try this. It seems to work, but hasn't been seriously battle-tested:

Move to Parent.kmmacros (9.3 KB)

Image

1 Like

My goodness, you’ve put a lot of work into this macro. I really appreciate your help.

Thank you, guys.

An alternative way to get the same result is a combination of @JMichaelTX’s 2.0 macro, @johns’s macro and “pause until” action at the beginning of the macro. (you can delete this action it if you prefer to hold both keys.)

Move To Parent Folder.kmmacros (14.1 KB)

The following macro works if the subfolder is expanded in list view.
Move To Parent at Front.kmmacros (13.9 KB)

Update #1: Fixing the copy delay. (Basically rearranged the actions)


Move To Parent.kmmacros (16.1 KB)
Move To Parent at Front.kmmacros (14.0 KB)

I might be only one using Mac’s weird way of pasting items, or moving them, to a parent folder in list view. It was confusing at first, but now I consider it a feature.

Macro trigger option using long press of hot key - JMichaelTX
Move to parent macro - johns

1 Like