Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


GuiB last won the day on December 5 2018

GuiB had the most liked content!


About GuiB

  • Rank

Profile Information

  • Location

Recent Profile Visitors

1,484 profile views
  1. @Jasondm007 Here is the same thing, but using AppleScript. In short, change the last Run Script to an AppleScript one with this script: on trim(theText) return (do shell script "echo \"" & theText & "\" | xargs") end trim on run argv set my text item delimiters to tab set theFileList to text items of (item 1 of argv) repeat with theFile in theFileList set fileAlias to (POSIX file trim(theFile) as alias) tell application "Finder" to move fileAlias to folder (path to downloads folder) end repeat end run Here is a new workflow with this inside in case it is easier to make it work: https://nofile.io/f/qvNgR5gw0pe/-+Example+File+Multi+Selection+Tests.alfredworkflow This one should work and give you something to play around when using AppleScript All the best!
  2. By removing this small part, you made it work as before. Like you said, while doing a real test I saw that the last element in the list of selection wasn't working and found out it was because of problem with whitespaces. So I trimmed the surround spaces with the trimmedPath="$(echo -e "${file}" | tr -d '[:space:]')" line and the trimmedPath variable include the file variable but trimmed. However, now I did more tests and found out there's still a bug with this line and now use an alternative using piping to xargs to do the trimming instead. Now, this seems to work, but again, let me know if you still have a problem! Here is the updated script for the Run Script: # Change IFS to TAB and expand into an array IFS=$'\t' filesListArr=($@) # Loop over the file list array for file in "${filesListArr[@]}" do trimmedPath="$(echo -e "${file}" | xargs)" # Your script to be run mv -i "$trimmedPath" ~/Downloads done Here is your script but updated with this fix: https://nofile.io/f/hjT4JFt6AVw/-+Example+File+Multi+Selection+Tests.alfredworkflow And here is my workflow with this fix: https://nofile.io/f/c8K4KEpkjWa/Example+File+Multi+Selection.alfredworkflow --------- To explain a little more why the other script doesn't work, but worked before on my side. The problem is that I was removing all the space in the file path, while the second one doesn't (it just trim the begining and end of the string; which is what I wanted in the begining, but did it too fast ). I'm used to never insert space on my file name, so that's why it worked before. But, now I tested iton a file that's inside my "Google Drive" and it removed the space inside to output it like "GoogleDrive" and broke it. Now we should be good
  3. Ok, I've tested it with a real action to do on each file. I didn't tested completely before, I just tested by outputing the path string to look at it, but now tested to do a real action on multiple files (copy them to a new file) and saw that the it didn't work on the last file in the list. So a little trimming to remove the whitespace on the file path worked. Therefore, here is an updated version that should work! @Jasondm007 sorry for the little problems with my other versions. I think this one is good now, but let me know if you still have problem! Here is the link to the new workflow: https://nofile.io/f/nTBEXw6Ku3U/File+Multi+Selection+&+OCR_Keywords.alfredworkflow And here the modified script for the Run Script that execute the action # Change IFS to TAB and expand into an array IFS=$'\t' filesListArr=($@) # Loop over the file list array for file in "${filesListArr[@]}" do trimmedPath="$(echo -e "${file}" | tr -d '[:space:]')" # Your script to be run automator -i "$trimmedPath" "/Users/NAME/Library/Services/NAME.workflow" done
  4. @Jasondm007 I just thought this morning that we don't have to create a new string if we combine both of our version... just need to update the array in the AppleScript and set the text item delimter to tab and output the array as a string. So here is my new version set my text item delimiters to tab tell application "Finder" to set theSelection to selection as alias list repeat with i from 1 to count of theSelection set item i of theSelection to POSIX path of item i of theSelection as string end repeat return theSelection as text And an updated Workflow example here: https://nofile.io/f/aqMoJwmGf8O/File+Multi+Selection+&+OCR_Keywords.alfredworkflow
  5. Yes, if you look inside the AppleScript node, I've set it as you did. However, now that you mention that, you're right that the first path uses /Users/ and the other /Macintosh HD/. I tried another way before switching to yours since I didn't test it first and then when I tested your I thought everything was fine. But my other version was to loop over the Finder selection to build a string delimited by TAB. I've tried again my version and with it I get all "/Users/" kind of paths Here is my modified AppleScript code: tell application "Finder" to set theSelection to selection as alias list set theFileList to "" repeat with i from 1 to count of theSelection set theFileList to theFileList & "\t" & POSIX path of item i of theSelection as string end repeat return theFileList And here is the new Workflow if you want to see it: https://nofile.io/f/scHz3m70RpG/File+Multi+Selection+&+OCR_Keywords.alfredworkflow Let me know how it goes!
  6. To simulate a left or right arrow key press you can use the Dispatch Key Combo action inside the Output > Dispatch Key Combo menu. Alternatively, you can use AppleScript, for example: -- To execute a left arrow key press tell application "System Events" to key code 123 -- To execute a right arrow key press tell application "System Events" to key code 124 You can have a look here for some reference on key code: https://eastmanreference.com/complete-list-of-applescript-key-codes
  7. @Jasondm007 I've updated the script for you to work with a multi selection. In short, you were not too far from having it. It's mainly your loop over your file list. I have changed it to: # Change IFS to TAB and expand into an array IFS=$'\t' filesListArr=($@) # Loop over the file list array for file in "${filesListArr[@]}" do # Your script to be run automator -i "$file" "/Users/NAME/Library/Services/NAME.workflow" done Here is the updated workflow: https://nofile.io/f/8ugP4mSgOMu/File+Multi+Selection+&+OCR_Keywords.alfredworkflow Also, I've edited every action to work with a multi selection, so you get an example with a File Action, a Hotkey and a Keyword action
  8. @zpete, I thought it could be great to point you to a related script I did for that (and more) so this can give you some more ideas... Just have a look at this script and discussion:
  9. Hi @Andrew, thanks for still having this on your radar! However, like @vitor and like you said, I doubt Apple would fix it. Also, I've moved to 10.13.6 since then so this is not relevant for me anymore and I also don't mind if you want to close this bug report.
  10. I confirm, I'm on 10.11.6 and this is happening on my side as well... I don't know exactly when this happened since I didn't use this feature lately, but I also think this is coming from a Security Update since I just did an update about 1.5 week ago to Security Update 2018-002. I tested with 3.6.2 Pre-Release (Build 915), 3.6.1 (Build 910) and 3.6 (Build 903) and none worked. So yes I think the problem is not caused by an Alfred update, but Apple... Also, I just updated to Security Update 2018-003 and the problem is still there. I hope Apple will fix this soon!
  11. Thanks @deanishe, it's always great to have tips to have better code and get better! Thanks for your help!
  12. The workflow disappear has Alfred didn't see a JSON format string (or XML) as the output of your Script Filter. If you don't want to output JSON/XML than it would be better with a simple Keyword object connected to a Run Script object. Then you will be able to do what you want (but you shouldn't press <enter> on your step 1, but more: 'jjj' <space>). If you want to do it with a Script Filter, just replace your script with: import sys, json query = sys.argv[1] data = { 'items' : [{ 'title': 'goto collection', 'subtitle': query, 'arg': query, }] } sys.stdout.write(json.dumps(data))
  13. @Neeson, yes I understand, I just wanted to make sure you knew it... I've also seen people tried to block the hotkey (remap to nothing) so it doesn't close the application by accident. As to why Alfred doesn't allow it, you can read @Andrew's post here to have a better understanding:
  14. I would recommend against it since CMD+Q is the native hotkey to close an application in macOS and why Alfred doesn't allow it natively, but there's workaround that you can try. If you want to do it in Alfred, you can create a workflow, add a Hotkey node connected to a Run Script one that ' tell application "Alfred 3" to search ' and that should pop Alfred. However, where is the trick is to set you hotkey since Alfred wouldn't allow it in the Hotkey node, but you need to edit directly the workflow "info.plist" to set manually the hotkey that you want like: (See the "hotstring" and "hotmod" keys) Also, other workarounds would be to use another application that would allow to register you hotkey and send a different key combination that you could use in Alfred: Ex: tell the application that when you type "CMD+Q" it sends instead "CMD+ALT+SHIFT+SPACE" and map Alfred to "CMD+ALT+SHIFT+SPACE". I didn't tried it, but Hammerspoon, BetterTouchTool or Karabiner may work for this Please note that for my first idea you would need to buy Alfred to create your workflow and this is mainly a workaround and not sure this will always work, so please if you want to go this route, keep this in mind. Using another application to switch the hotkey would be a safer method if you can make it works and you could try before buying, but as noted above, I would recommend against since this is the shortcut for quitting an application on macOS, but I understand if you've been using it for many years.
  15. @Mightymuke , you are right, I did this node too fast while adding the unicode normalization this week... Here is a new update with this bug fix: https://nofile.io/f/TocAqvK7JJJ/gbCardhop.alfredworkflow However, now I have a bigger problem since Cardhop 1.1 added localization and English actions doesn't work when you are in another localization. So, I'll see what could be changed to make it works for everyone (extract all the localized strings from Carhop or maybe ask the Cardhop team if it would be possible to keep the English actions word working in other language (as I think I would prefer this since I'm used to write those kind of actions in English than in French: I'm used to write "mail personName" than "écrire personName", but not sure they would want this)) @cands, you should update to this one to have this bug fix
  • Create New...