nonickfx Posted October 16, 2018 Share Posted October 16, 2018 Hi everyone, I am trying to set up a very simple workflow: Select one to n items in Finder Fire up the Alfred dialogue with file actions Automatically select the "move to" file action Type in the folder I want to move files to 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? Thanks! Link to comment
deanishe Posted October 16, 2018 Share Posted October 16, 2018 Alfred has a built-in Hotkey to open its File Action list with the files currently selected in Finder. Link to comment
nonickfx Posted October 16, 2018 Author Share Posted October 16, 2018 Yes, I'm aware of that. However, this hotkey requires you to first activate it and THEN press "cmd+6" to get to the "move to" dialogue. I'd like to be able to do BOTH with one hotkey. Thanks Link to comment
deanishe Posted October 16, 2018 Share Posted October 16, 2018 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
nonickfx Posted October 16, 2018 Author Share Posted October 16, 2018 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? Thanks! Link to comment
deanishe Posted October 16, 2018 Share Posted October 16, 2018 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 nonickfx 1 Link to comment
nonickfx Posted October 16, 2018 Author Share Posted October 16, 2018 Wow, works exactly as I wanted, thanks a lot!!! Just to make sure: I am connecting the hotkey to "Run Script" and set it to "usr/bin/osascript" and "with input as argv" , correct? (sorry, I'm a total Alfred newbie). p.s. enjoy your beer, just sent you one ? ? deanishe 1 Link to comment
deanishe Posted October 16, 2018 Share Posted October 16, 2018 Yup, that's right. The input doesn't matter, though, as the script gets the files directly from Finder. Thanks very much for the beer money! I'll get a couple of bottles to enjoy while France destroys Germany tonight Link to comment
nonickfx Posted October 16, 2018 Author Share Posted October 16, 2018 (edited) Ok, got it! Haha let's see ? Edited October 16, 2018 by nonickfx Link to comment
deanishe Posted October 16, 2018 Share Posted October 16, 2018 (edited) Kopf hoch! Ständiges Versagen ist auch eine Form der Zuverlässigkeit Edited October 16, 2018 by deanishe Link to comment
nonickfx Posted October 8, 2019 Author Share Posted October 8, 2019 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 Thanks!! Link to comment
Mike Outram Posted October 9, 2019 Share Posted October 9, 2019 Hi @nonickfx - will this take any file and move it wherever you tell alfred to put it? Sorry I can't help with the code. I was just searching for a way to have Alfred move files around. Link to comment
nonickfx Posted October 24, 2019 Author Share Posted October 24, 2019 Yes, that's exactly what I'm looking for. Anyone any idea? Still couldnt figure it out. @deanishe : Hast du eine Idee? :) Link to comment
nonickfx Posted October 29, 2019 Author Share Posted October 29, 2019 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
deanishe Posted October 29, 2019 Share Posted October 29, 2019 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now