What the macro does:
When you press ⌘A…
- it will execute a ⌘A keystroke (Select All)
- if you rest a tad longer with the finger on the A it will copy the selection and confirm it with a little ‘Tink’ sound.
I searched the forum and didn’t find any similar macro posted. That’s a bit surprising because it’s extremely handy, since ⌘A is very often followed by ⌘C. So it saves quite a bit of finger work.
Select All and Copy.kmmacros (4.5 KB) — 2016-08-26
Update (2016-08-26): Added a “backup” Enable Macro action at the end of the macro.
There were cases where the macro failed to re-enable itself. The second Enable action should reduce the likelihood of this to happen.
Update (2016-07-05): Removed the ⌘-key-down condition. I noticed that ⌘-key-down was sometimes not recognized, hence the Copy action wasn’t executed. I don’t know why. Restarting the KM engine seems to help temporarily, but without the ⌘-key-down condition it works reliably now. (It wasn’t really needed anyway.)
Update (2016-07-01): Repositioned Enable Macro action, so that a failed Copy action (e.g. when the selection is empty) cannot prevent the macro from re-enabling (thanks @peternlewis).
The Disable Macro action is necessary to free ⌘A for its regular Select All function. Otherwise nothing would get selected and the macro would enter a loop.
On rare occasions (when you execute the macro repeatedly) the Enable Macro action is not executed, that is, the macro remains disabled. I don’t know why this happens (?)
With the delay of
0.05s the Copy action will trigger when you rest just a tiny bit longer on the A key. Depending on your personal key pressing style you may want to experiment with different values.
(If you change the If Then condition from all to any you can also trigger it with a prolonged press on ⌘ alone.)
Note: The 0.05s do not reflect the actual delay. The actual delay is rather the sum of the “natural” delays of the actions plus the 0.05s. (Even when you remove the Pause action you still have a noticeable delay.)