I've been over on the Alfred forum, researching options there. All I'll say about the experience so far is that I love the KM forum even more than I already did!
I don't want to speak too soon, but I may be very close to a nice solution for this, at least for me. The beauty of using Alfred is that it shows the actual folder hierarchy and never needs to be manually updated. Here's where I'm at:
The hotkey navigates to the parent directory of my collection of subfolders in Alfred's interface. From there, I can drill down to the desired destination folder before hitting the second hotkey. This runs a script that captures the path of the selection in Alfred's browser and moves the Finder selection to that location.
Here it is in action:
Here is the osascript being used, which was sent to me by an Alfred forum user:
on run (argv)
tell application "Finder"
-- set destination from first command-line argument
set _destination to POSIX file (first item of argv) as alias
set _selected to selection as alias list
move _selected to _destination
- The script copies (rather than moves) the Finder selection when attempting to move between volumes. I'm pretty sure @ccstone will know why, as he kindly sent me a slightly different script yesterday that moves things perfectly.
- It opens the destination folder in a new Finder Window which may or may not be desireable.
- It involves two hotkeys. As far as I can tell, you can't pause a workflow until a key is down (Enter, for example), as you can with KM. You have to set them up as separate workflows that can be triggered with more hotkeys, or alternatively as "File Actions" to be manually selected from a dedicated menu.
I did try to think of a solution to this. It's a bit convoluted but hopefully makes sense:
The hotkey would firstly trigger a KM macro that pauses until the Enter key is down. After a very short delay, Alfred's browser navigates to the parent directory. The delay just ensures that the navigation triggers properly. After you have your desired destination folder selected, you would hit Enter, at which point KM would trigger the file-moving script in Alfred.
And of course, it doesn't work.
I think this may be because when you hit Enter it closes Alfred's file browser, so there is no longer a selected path for the script to reference.
The solution to this (and take this with a pinch of salt as a lot of this is slightly beyond my level of confident understanding) could be to have a looping script in KM that checks the current selected path in Alfred's browser and then runs the file-moving script based on the last one it sampled. Now, whether or not it's even possible to reference Alfred's browser selection from an external script would determine whether this is at all viable, and I'm flying blind there too.
Hopefully you can see that there's a nice and neat solution to this file sorting challenge that's almost within reach, and I'm sure that a veteran Alfred or KM user would be able to finesse it no time.
If only you could get Enter to trigger the script in Alfred, all of this would be a lot simpler!