Jump to content

Error in Workflow to move multiple files

Recommended Posts

Hi everyone,


I am trying to set up a very simple workflow: 


  1. Select one to n items in Finder
  2. Fire up the Alfred dialogue with file actions
  3. Automatically select the "move to" file action
  4. Type in the folder I want to move files to
  5. Files are moved


What I have so far: 




This works perfectly, but only for ONE file. i.e. if I select multiple files, only one shows up in Alfred.





And this works for multiple files (I defined ^+SHIFT + < as File Action trigger), but it doesn't register cmd+8 for some reason. I.e. I get to the file actions dialogue but would have to hit cmd+8 myself. 


Can anyone help? 



Link to comment
1 minute ago, nonickfx said:

However, this hotkey requires you to first activate it and THEN press "cmd+6" to get to the "move to" dialogue


That isn't going to work. Your workflow has ⌘8. Now you're pressing ⌘6. You can't hardcode a Hotkey that keeps changing.


You'd be better off using Alfred's AppleScript API to action the files, type "move to" in the query box, then simulate ↩.

Link to comment

The problem is not that the hotkey is changing, I can hardcode ⌘8 and it would be enough for me. The problem is that I can't find a way to select multiple files and then trigger the File Action list AND the Move-to action. Is there any way to do this?


Regarding your solution: I didn't quite understand how I'd do it. Can you please elaborate a bit? 



Link to comment
  • 11 months later...

Hi everyone,


so after an update to Catalina the following script doesn't work anymore: 


tell application "Finder" to set selList to selection as alias list


if selList is not equal to {} then

    tell application "Alfred 3" to action selList

    tell application "System Events"

        keystroke "Move to"

        key code 36 -- Return

    end tell

end if


Can anyone help? I can't figure out what's wrong :(



Link to comment
  • 2 weeks later...
tell application "Finder" to set selList to selection as alias list
     tell application "System Events"
        key code 16 using {command down, shift down}
	    delay 0.2
	    keystroke "Move to"
	    key code 36
    end tell

here's my current workaround. Assumes that you have the combination "shift + cmd + z" to trigger alfred action on a set of files. any ideas how to avoid using the "delay" function (does not seem good coding style to me). 

Link to comment
54 minutes ago, nonickfx said:

the combination "shift + cmd + z"


key code 16 maps to the physical key, so it's Z on your QWERTZ keyboard, but Y on a QWERTY. keystroke "z" using {command down, shift down} is more portable.


39 minutes ago, nonickfx said:

any ideas how to avoid using the "delay" function (does not seem good coding style to me).


It's not really possible, AFAIK.


It's not good coding style, but you don't have much choice when you're just blindly firing key presses an at application. That's why it's a last resort for automating apps.


With "regular" applications, you can wait until that application is frontmost, but that doesn't work with Alfred because it is never the frontmost app.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...