Jump to content

GuiB

Member
  • Posts

    366
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by GuiB

  1. @nikivi, it's great seeing you're still using my code As for accessing the "Move to..." directly, I don't see another way at the moment, but using simulated keystrokes... @Andrew, maybe it would be great to make native Alfred's File Actions items accessible using External Triggers ? So that we could do something in the like: tell application "Alfred 3" to run trigger "Move to..." in workflow "Alfred's File Actions" with argument "/path/to/file". This way we could directly access those actions from anywhere. I think this could be great also from a Workflow point of view, so we don't recreate actions that are built-in like "Delete", "Copy To...", "Get Info", "Open With...", "Email To...", ... To get back to your question @nikivi, what I think I would do at the moment is something like: aw "/path/to/your/file" && osascript -e "delay 0.1" -e "tell application \"System Events\" to keystroke \"Move to...\" & return" I'll let you know if I find another idea!
  2. Wasn't the "Snippets" feature of Alfred made for that ? Look here for information about how to use it: https://www.alfredapp.com/help/features/snippets/ But in short, you can create collections of snippets that would be kept indefinitely and that you can search through your collections using your defined Snippet Keyword ("snip" by default) or use a hotkey to access the list. Some great things about this instead of a List Filter is that you can send an item from your Alfred Clipboard Viewer using CMD+S when you select an item in it, also when you press enter on a selected snippet then Alfred would automatically paste it into your front application or if you want it on your clipboard instead of automatically pasting it, then just press CMD+C when you've selected the snippet that you want.
  3. Not sure this is what is happening here, but I can't find an option to disable the highlighting either... but could it be that you've set the opacity of the highlight colour to 0% or you've changed the colour to the same as the background colour and made some other colour change like the title/subtitle/Enter symbol ? You can try to go back to the default theme and see if the highlighting reappear.
  4. @evanfuchs, sorry for the delay, I needed to go... but I've found that you were maybe talking about the Capitalize action which I didn't modify before. I've found that it did what you said (it strips existing line breaks), so I fixed it (now using a simple python "capitalize()" function) Here is the updated workflow: https://nofile.io/f/0j4Gjdxwoby/Funnel.alfredworkflow Best!
  5. @evanfuchs, you're right, sorry Here is an update with a fix to to the Titlecase: https://nofile.io/f/uQ4rUGs1Ra3/Funnel.alfredworkflow
  6. Not without touching the code, but here I made it works for you. However, note that this would get reverted if you update to a newer @ctwise update if he don't make the change to his workflow. In short, in "filters.json" change "perl -nle" to "perl -ne" for the "lowercase" and "uppercase" actions. Change line 79 (print $_, "\n";) in the file "titlecase.pl" to "print $_;" and line 37 ($line =~ s/^([ \t]*)(\d+\. |[\*\+\-] )?\s*(.*)/${1}${3}\n\n/;) in the file "bulletlist.pl" to "$line =~ s/^([ \t]*)(\d+\. |[\*\+\-] )?\s*(.*)/${1}${3}/;" Download: https://nofile.io/f/B3kpSz6Pxom/Funnel.alfredworkflow
  7. Insert 2 spaces after "|" or change the Script Filter node for the "|" keyword to "Argument Optional" (I think the second option would be best if you still want to filter the results normally)
  8. @raygan, if there's a URL scheme then you can just use the Alfred "Open URL" object with your query ("rcmobile://call?number={query}") if you want a simpler workflow
  9. If what you want is just a custom action in the File Action list, then you need to create a workflow and add a "File Action" node (Inside the "Triggers" menu). Then set a name and connect the node to another one that will process the file the way you want it. For your example, you would need to create multiple File Action node, one for each action: npm run dev, npm build... Or if you want to create a File Action that pop another list of actions to do (like a group of action when you select an action: Example: create a "npm" File Action that link to multiple related actions like run dev, build, deploy...), then follow @dfay link for some examples. Best!
  10. At least, I think this is something that could be useful for multiple kind of workflows (I mean, it's just some ways of keeping the files list in a consistent way that could be used later in the workflow). So, I think it's great to have one or many solutions that we know works and that we can have a place with reference to look at.
  11. Look inside the workflow for the solution using Bash. This should be faster to load and execute. You're right that Python could be slower to start and load modules, but I often prefer to work in memory instead of manipulating files. If you want a faster script (not sure how faster it is if any, we would need to do a speed test...), then maybe you'll be better to stay with Bash... For your Script node connected to the File Action and using the Bash language (convert arguments to a newline delimited string and output): IFS=$'\n' echo "${*}" - Then, same as before with the Arg and Vars (that set the 'filesList' variable) and the List Filter - Then, connect to another Script node using Bash to process the files: IFS=$'\n' filesListArr=($filesList) ./tag -a "$1" "${filesListArr[@]}" Updated workflow with this code for the newline delimited string method (if it's useful to someone): https://nofile.io/f/jWPWou9CT1D/Tag+Files+with+List+Of+Tags.alfredworkflow
  12. @deanishe, thanks for your input! I like it, short and sweet! I've updated my workflow with your mentions and simplified my python scripts on the version that uses a newline delimited string. To have it as reference here in this forum. To convert the files list into a newline delimited string: - Connect a Script node to the File Action node with the language set to "Python" import sys sys.stdout.write("\n".join(sys.argv[1:])) - The output then set a variable using the Arg and Vars node (where the variable name is set to "filesList" in this example) - Then the List Filter node to specified the action to do - Then to reuse the newline delimited string for this tagging workflow example using a Script node with the language set to "Python": import sys, subprocess, os cmd = ['./tag', '-a', sys.argv[1]] + os.getenv('filesList').split("\n") subprocess.call(cmd) The updated workflow: https://nofile.io/f/S05SkQpvGdk/Tag+Files+with+List+Of+Tags.alfredworkflow
  13. You're right that Bash scripting is often not so intuitive, but I meant that those snippets to split the string into an array or to expand a list into multiple arguments are not too hard to keep around to use again in another workflow. But you're right that the syntax is quite obscure and less intuitive than a string.split('\t'). @dfay, your method to output to a file and parse it by splitting it's lines into an array is not so different than to build a string where the files path are delimited by a newline and where an Alfred variable is then set with the content of this string (so kept in memory instead of manipulating a file). I've done it in my updated workflow to give you an example in Bash and Python. Also, I've made a third example to play around with the way @deanishe thought it by using a JSON string. In short (as reference if you prefer not to download the example workflow): - Put a File Action node - Connect it to a Script node to create the JSON string from the ARGV: #!/usr/bin/python import sys, json data = [] for i, filePath in enumerate(sys.argv[1:]): data.append({ 'filePath'+str(i) : filePath }) sys.stdout.write(json.dumps(data)) - The output set a 'filesList' variable as my other example with a "Arg and Vars" node - Then a List Filter node to show the Tags list - Then a last Script node to process the files using: #!/usr/bin/python import sys, subprocess, os, json tag = sys.argv[1] pathsJSON = json.loads(os.getenv("filesList","")) paths = [] for items in pathsJSON: for key, value in items.iteritems(): paths.append(value) cmd = ['./tag', '-a', tag] + paths subprocess.call(cmd) Both way seems to be working fine! (files path delimited be newline or by creating a JSON string) Here is the workflow to have an example to play with: https://nofile.io/f/mnNgmh60OB2/Tag+Files+with+List+Of+Tags.alfredworkflow
  14. @dfay, about escaping spaces in tags and filenames... make sure to quote your strings ( "$1" ), then the command would see it as one argument.
  15. @deanishe, yes there's simpler solution to deal with tab separated string, but in this case I don't think it's too much trouble. I mean, I'm not an expert of shell scripting, but I found a simple solution to split a string delimited by tab into an array and expand the array into different command arguments: Split the string into an array: IFS=$'\t' read -a filesListArr <<< "${filesList}" Expand the array to use it as multiple command arguments: ./tag -a "$1" "${filesListArr[@]}" @dfay, you were talking about multiple actions, so that's why I used multiple pathways, but yes, in your case it is simpler to only use one. Here I made an example that should do what you want and with my above solution for the files list into an array Download: https://nofile.io/f/E11PVYVee0Z/Tag+Files+with+List+Of+Tags.alfredworkflow
  16. Is it what you want to achieve ? Basically, keep the files list in a variable, put a List Filter with your actions then get back to your files list variable and process it based on the selected action. Example: https://nofile.io/f/p74AgaZujug/File+Action+with+List+Of+Actions.alfredworkflow
  17. If Alfred doesn't find your file, then there's a problem with your Spotlight index or it's not in your Alfred Search Scope. However, to get the path from your selection in Finder, just use the "Copy Path to Clipboard" action of Alfred File Action feature. To use it, make sure to assign a hotkey from the Alfred Preferences to get the file selection: "Alfred Preferences > Features > File Search > Actions > File Selection". Then, when you have the file selected in Finder, just use your hotkey to pop the Alfred's list of actions and look for the one named "Copy Path to Clipboard", press Enter and you should have it in your clipboard and you should be fine pasting it in Excel. If you want to use a keyword instead the way you are saying it, then you will need a Workflow. So here is one if you prefer this solution: https://nofile.io/f/pmC0ht6SFGP/File+Path+To+Clipboard.alfredworkflow
  18. Version 1.2.1 Added "Skype for Business" in the Cardhop's action list (new action from Cardhop 1.0.2) Download link: Link in first post or https://nofile.io/f/ObcZMuqzaGT/gbCardhop.alfredworkflow
  19. Update Version 1.2.0 Big update, many more features and faster... New Features: Keyword "chs" or Hotkey: Added items to go to the Favorites or Actions list Keyword "cha" : Show a list of possible Carhop actions. If arriving to this function using the Send feature (chs), then the selection or query would be appended to the Cardhop action before sending it. (Could be used as an easy way to remember possible actions that can be done with Cardhop) Favorites List : A new variable "{q}" could be used to have a placeholder for a string that you want to set just before sending to Cardhop (ex: "Email {q} work" where {q} could be changed to any name at the time that you invoke the workflow). Append/Prepend string : Add a string before or after the main string before sending using a predefined list or any string if the query doesn't match an item in the list (Could be useful to have a list of predefined group/tags: /Business;/Friends...) New Workflow Environment Variables: AppendToSend : Set a predefined list of string (separated by semicolon ";") to append using the Append feature (ALT key) PrependToSend : Set a predefined list of string (separated by semicolon ";") to prepend using the Prepend feature (CTRL key) Navigation: CMD key : Go to the Send feature Actions List (chs) ALT key : Activate the selected item and append extra string (using the AppendToSend list) CTRL key : Activate the selected item and prepend extra string (using the PrependToSend list) Download link: https://nofile.io/f/A5joYTcGU88/gbCardhop.alfredworkflow
  20. @mickaphd {clipboard} inside an "Open URL" object won't be expanded, but using the "Arg and Vars" it will. So you can just add a "Arg and Vars" object before the "Open URL" that would send the content of the clipboard and use "iina://weblink?url={query}" for the URL Here is a small workflow to show you this method: https://nofile.io/f/yKeyvqbN4zd/SendToIINA.alfredworkflow Best!
  21. @able, thanks for your kind word! And yes, Cardhop input field is already nice to work with, but I think this workflow gives just enough little extras to make it more convenient and faster
  22. Update Version 1.1.0 New Feature: Keyword "chf" : Send a string from your Favorites list directly to Cardhop (could be used as a Snippets/Bookmarks list to rapidly write a query to Cardhop that you know gives you the right information in it without the need to write it all). Write your list in the Workflow Environment Variables "Favorites" and separated by semicolon (";"). Example on how to insert items in the Workflow Environment Variable "Favorites": Call mom home;Mail boss work;facetime Complicated Name;website businessName;/MyTag;Direction dentist Tip: To directly activate an action in Cardhop: it seems to delay the input until it has done parsing the query, so you can rapidly press Enter a second time when you select an item from your Favorites list in Alfred and it should run the first action that Cardhop returns. Download link: https://nofile.io/f/vkgor7xxgvn/gbCardhop.alfredworkflow
  23. @LynneS note that Alfred and Spotlight would search inside PDF when the text is inside the Metadata of the file. I mean, if you have PDFs that contain only images (ex: simple scanned PDF where no optical character recognition (OCR) was done), then they won't be able to search the content. I don't really use Evernote, but if I remember well, they would scan the PDF to extract the characters from it to make it searchable (they have an OCR feature built-in). However, this depend on the PDFs that you use, if you are already able to search for them in Alfred or Spotlight, then you are good to go! But, if some of your PDF doesn't embed the characters but only the images, then you would need an extra application that do an optical character recognition and add it to the PDF to make it searchable (some that I know that should do the job: PDFpenPro, DEVONthink Pro Office, OCRKit, Prizmo, or search for OCR applications). If you're not sure if the file contains the character, try opening it in Preview and try to select some text. If you are able, then you should be fine, if not, then your PDF must contains only images.
  24. Hey @able, @Ehler and everyone! I uploaded my Cardhop Workflow to the workflow section of the forum if you want to have a look and try it and with some tips to use Alfred with Cardhop. I hope you like it! Best!
  25. I played around with Cardhop and here is a workflow that I made. I wanted to get more time before sending some workflows to the forum to setup a repository and with an auto-update to the workflow, but I didn't have the time yet for that. And since some people mentioned that they would like a workflow for Cardhop, here is one! Features: Keyword "chc" : Search a contact in Alfred and open it in Cardhop Keyword "chs" or hotkey : Send the query to Cardhop. If the query is empty, it tries to get the selection from the front application and send it to Carhop (In short, you can select the contact information on it's website or email and call "chs" from Alfred and the selection should be sent directly to Cardhop). You can use this action to send the selection or pass a string to your Favorites list (alternative to keyword: chf) or to the Cardhop's Actions (alternative to keyword: cha). Keyword "chf" : Send a string from your Favorites list directly to Cardhop (could be used as a Snippets/Bookmarks list to rapidly write a query to Cardhop that you know gives you the right information in it without the need to write it all). Write your list in the Workflow Environment Variables "Favorites" and separated by semicolon (";"). Ex: Call mom home;Mail boss work;facetime Complicated Name;website businessName;/MyTag;Direction dentist... A variable "{q}" could be used to have a placeholder for a string that you want to set just before sending to Cardhop (ex: "Email {q} work" where {q} could be changed to any name at the time that you invoke the workflow). Tip: To directly activate an action in Cardhop, it seems to delay the input until it has done parsing the query, so you can rapidly press Enter a second time when you select an item from your Favorites list in Alfred and it should run the first action that Cardhop returns. Keyword "cha" : Show a list of possible Carhop actions. If arriving to this function using the Send feature (chs), then the selection or query would be appended to the Cardhop action before sending it. Hotkey to Send selection to Cardhop : If you prefer to send the selection directly to Cardhop with a hotkey instead of a keyword Fallback search to send the query to Cardhop : If you want to write the information directly in Alfred without any keyword before. To make it works, you would need to add the Fallback search into the Alfred Preferences at: "Features/Default Results/Setup fallback results/+/Workflow Trigger/Send to Cardhop" External trigger to send a string to Cardhop from an external script. Other external triggers are set if you want to pop the Favorites list or Actions list from an external script. Append/Prepend string : Add a string before or after the main string before sending using a predefined list or any string if the query doesn't match an item in the list (Could be useful to have a list of predefined group/tags) (See "Workflow Environment Variables" and "Navigation" lists below) Workflow Environment Variables: Favorites List: See keyword "chf" above AppendToSend : Set a predefined list of string to append using the Append feature (ALT key) PrependToSend : Set a predefined list of string to prepend using the Prepend feature (CTRL key) Navigation: CMD key : Go to the Send feature Actions List (chs) ALT key : Activate the selected item and append extra string (using the AppendToSend list) CTRL key : Activate the selected item and prepend extra string (using the PrependToSend list) Tip: If you want to use Cardhop as the application to open from Alfred when you are viewing a contact with the Alfred Contact Viewer and press CMD+O: Insert "x-cardhop://show?id={uid}" into the Alfred Preferences at "Features/Contacts/Advanced/URL Handler" instead of using "addressbook://{uid}". This should do the same as the keyword "chc" but without the need to write the keyword before searching for a contact and use directly the built-in contact search of Alfred Download Link (latest version): https://d.pr/f/SX4Sn7 Download Link (older version, latest version using Python 2): https://d.pr/f/rQTPtu Have fun!
×
×
  • Create New...