I would like to get the filename or file path of the file I'm currently working on (not Finder selection) and copy to the clipboard.
Is there a way to do this in KM?
I would like to get the filename or file path of the file I'm currently working on (not Finder selection) and copy to the clipboard.
Is there a way to do this in KM?
Hey @sccardais,
Probably not with 100% reliability — it depends upon how well the developer has implemented accessibility in their app.
But this macro should work most of the time:
Finding the file path for an open document in the Front Application
-Chris
Thanks very much Chris.
I’m new to Keyboard Maestro so I’m sure this is an ultra-newbie question but is there an action I can add to the macro you sent that will copy the filename to the clipboard?
Thanks very much.
Scott
Hey Scott,
Sure.
Remember that you can use ⌃⌘A to bring up the action-selector.
Keyboard Maestro Editor > Edit > Insert Action > By Name
It has a smart search, so you can search for something like “clip var” to find items that share clipboard and variable.
What you want is the Set Clipboard to Text action:
NOTE — you can directly send the result of an AppleScript to the clipboard, so by rewriting the AppleScript you could have just one action.
-Chris
The topic and URL for the macro in post #2 has changed.
-ccs
Thanks, Chris.
Worked like a charm.
Scott