Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by GuiB

  1. @deanishe, yes, it wasn't clear if it was possible to retreive the contact information from the api, so I gave an alternative if @Dreamisdead could only get the name of the contact and have the contact information from is own Address Book database... But yes, if everything is inside your API, then yes it shouldn't be too difficult to write a script filter to extract the full contact information from the API. Also, a little tip, if you want to access the email or phone or something directly from your first Script Filter, you can make use of your modifier keys to access them directly. For example: CMD+Enter to get the email address and put it in your clipboard directly or opening a new email with this address directly... it's up to you! Happy coding!
  2. I don't know if I get it right, but if you want to search for a contact and get the output like the default contact search of Alfred, then you can search your address book database using a File Filter based on your contact name that you get from your first script filter and send the found contact to open in Alfred (if Alfred is set to "Open Contacts in Alfred"). What I mean is: [Your Script Filter] -> {query is now your contact name} -> [The File Filter that gives you a list of matches] -> [Open the match in Alfred] Here is an example: https://d.pr/f/yIPU1v Just change the "ys" keyword object to your Script Filter If you Employee name is always the first in the list then you can rapidly press a second Enter to go directly to the Alfred Contact Viewer (or automate this second Enter key press) It could be done by using a second Script Filter, but if you want to access your contacts database directly then I think using the File Filter could be an easy way To give credits, my File Filter that search the Address Book database is a modified version of @Vero workflow that you can find here:
  3. Just to add... this would also make it possible to copy a selection of the text that is further down in the view and paste only the relevant part that we want.
  4. It would be great if the right pane of the clipboard history (the preview side) could allow to scroll to read all the contained text when it is longer than the available space. Sometimes we could have multiple clipboard contents that have some changes further down where we can't see it so we can't really know which one to choose. There's the Large Type (CMD+L) that make it possible sometimes, but other times the text is too long to make it readable using Large Type. So, adding the possibility to scroll the preview would be great! Thanks
  5. I think this will give you what you want: You can download an exported snippet collection here: https://d.pr/f/wWdRPN Or, if you want to build them yoursel, create new snippets with: nmonth => {date +1M:MMMM} pmonth => {date -1M:MMMM} mmonth => {date:MMMM} You can find more about snippet date arithmetic and format here: https://www.alfredapp.com/help/features/snippets/ and here: http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
  6. Ok, I understand, it's just a little confusing that it changes a feature from another place in the preference. Now, I'm seeing that checking from one place or the other uncheck the other. I was thinking that the "Use ← and → for folder navigation" would only work when inside Alfred's File Navigation (while browsing the file system) and not during a standard search so that in a standard search I could use the → key to open the file action menu and during a file navigation I could use the arrow to navigate in and out of folders. So, not so much of a problem, I was just confused a bit that after testing the file navigation feature with the arrow keys that when I unchecked the toggle to get back where it was, Alfred didn't revert to work the same way as before since it also unchecked the toggle from the Show Actions. I'll keep in mind that they are linked
  7. I'm not sure if it's intentional, but I like to use the → key to access the File Actions when finding a file in Alfred. However, I've been surprised that this key wasn't working anymore. Actually, I've been playing around with the File Navigation function to "Use ← and → for folder navigation" and now realized that when we uncheck this feature in the File Navigation preference, it also uncheck the "Show Actions : [ ] → " of the File Actions preference. I understand that both feature could be related, but it's a little surprising to find out that a checkbox manipulate another one on another preference pane and especially since the "→" key is checked by default to access the File Actions. I'm just wondering if this is wanted or not. If it is, maybe there could have a mention that unchecking the "Use ← and → for folder navigation" will also uncheck the one in the File Actions menu or maybe it would be preferable to pop a dialog to ask the user if it also wants to uncheck the arrow for the File Action as well.
  8. @shainekim ah, sorry, I read too fast and didn't see you wanted in a new window. For that I think there's a option in Chrome to open link in new window, but if you don't want to change your Chrome preferences for your workflow, here is some more way to do it... If you have problem with the "quoted form of" then it's better to url encode your string. It's quite easy with Python, so I showed you how to pass and access the output of it in this updated workflow. Also, I've seen that Google Chrome can be asked by the "open" command to open in a new window using the argument "--new-window", so I added an example with it and an example using AppleScript to open in a new window and another example using only a single Run Script using Applescript. Here is the updated workflow: https://d.pr/f/JnjG9F Have a look at the keywords: "yy3", "yy4" and "yy5"
  9. To give you another perspective... you may find it easier to use builtin Alfred object for your workflow. From my understanding, you can do what you want simply by using a Keyword object connected an Open URL object. Often, a website will give you their homepage if the search function has no argument (like if you open the url: https://www.youtube.com/search?q= ), so if it's what you want, then you don't need to check if the query is empty or not. However, if you want to direct to a different URL than you can use the 'Filter' object of Alfred to check if the query is empty or not. Here is a workflow I did to show you both method in case you want to go this way: https://d.pr/f/q0uX2H Also, I would recommand to use the Open URL with your default browser (since I think Chrome is your default web browser and this way it would follows your preference if you switch someday), but if you want to specify to open in Chrome then you can set it into the dropdown menu at the bottom of the Open URL object. Best!
  10. From your screenshot it seems to be ok, but if you copy+pasted the string from Alfred to your post above when you say: then we can see there's a space after the "x" at "x -cardhop..." that shouldn't be there... So please try by removing this space if it's there or by copy pasting this: x-cardhop://show?id={uid} I hope this helps!
  11. @luckman212, yes to use the output of the script I would use an Alfred External Trigger that is triggered by the JXA so we can do something from Alfred. So, yes you can write to a file or directly use the argument to the Alfred External Trigger. I've made an example here: https://d.pr/f/2rzrt1 Here is the inside JXA script for those wanting to see directly without downloading: ObjC.import('Foundation') const args = $.NSProcessInfo.processInfo.arguments const argv = [] const argc = args.count for (let i = 0; i < argc; i++) { argv.push(ObjC.unwrap(args.objectAtIndex(i))) } delete args // Use argv[1] and up for the input arguments Progress.description = "Progress indicator; Input Args = " + argv[1] Progress.totalUnitCount = 25; for (var i = 1; i < 26; i++) { Progress.additionalDescription = "Step at: " + i Progress.completedUnitCount = i delay(0.1) } Application('Alfred 3').runTrigger('progress_bar', {inWorkflow: 'gbProgressBarExample', withArgument: "Total Count = " + Progress.totalUnitCount})
  12. @bivalvegruff, the output you wrote means that the preference is not set on you computer, you should see an output that only mention: org.yanex.marta Did you sent the second command as well? ( defaults delete -g NSFileViewer ) This one is meant to be use if you want to revert back to Finder and should then give the output that you have now when writing defaults read -g NSFileViewer . You can try again with the first command only ( defaults write -g NSFileViewer -string org.yanex.marta; ) Here is what I get on my side in the Terminal: $ defaults write -g NSFileViewer -string org.yanex.marta; $ defaults read -g NSFileViewer org.yanex.marta
  13. I also sometimes want to have a way to see some kind of progress (mainly to see if my process as complete), so I used an Automator Process that is called from Alfred so a gear icon appears in the menubar to clearly show that the script is running. However, it stays at 0 and quit when it's done. So, it is a little like what you are after. I thought why not run an AppleScript applet from Alfred and found a way that can also accept an argument to the applet using JXA. For some reasons, the on run argv doesn't work directly to get the input arguments so we need to use the Objective-C bridge. In short, you write a JXA application (applet) using Apple Script Editor that would do the action that you want while updating the progress bar. Move the bundled application into your Alfred Workflow directory and call it (start it) from Alfred using a Bash script like: open ./progress_example.app --args "$1" As for the JXA script, it should look like this (edit to make it do the things that you want...): ObjC.import('Foundation') const args = $.NSProcessInfo.processInfo.arguments const argv = [] const argc = args.count for (let i = 0; i < argc; i++) { argv.push(ObjC.unwrap(args.objectAtIndex(i))) } delete args // Modify what is here after so your applet makes the action that you want // Use argv[1] and up for the input arguments Progress.description = "Progress indicator; Input Args = " + argv[1] Progress.totalUnitCount = 25; for (var i = 1; i < 26; i++) { Progress.additionalDescription = "Step at: " + i Progress.completedUnitCount = i delay(0.1) } Here is an example in a Workflow: https://d.pr/f/rQPVmD So, if you want to see your progress directly in Alfred you can use the rerun feature or if you want to have a popup that shows you the progress while you do something else, then you can try my solution and see if it fit for you. Also, it should also be possible with cocoaDialog or something else, but I didn't have the time to try it at the moment.
  14. @bivalvegruff, did you restart your computer or session? If you write in terminal defaults read -g NSFileViewer you get org.yanex.marta as output? Myself, I'm always opening the files using the Reveal in Finder action (CMD+Enter on a standard search or with the Reveal in Finder file action) and it works great on my side. However, if you open your file using only Enter while doing the file search then it seems that you need to also set another preference to Marta like: defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{LSHandlerContentType="public.folder";LSHandlerRoleAll="org.yanex.marta";}' This is all the same as what is explained at the Forklift website, so you can have a look here to have some more info: https://binarynights.com/manual#fileviewer Hope this helps!
  15. Alfred uses the default file browser from your Mac. Finder is the default, but some alternatives (like Path Finder) add a preference to set them as the default file browser (taking the place of Finder). Therefore, to do what you want, it's not really related to Alfred, but to your computer configuration. You can set Marta as the default file browser with the command (inserted into the Terminal): defaults write -g NSFileViewer -string org.yanex.marta; And revert to Finder with this command (if you want to switch back): defaults delete -g NSFileViewer * Note that you would need to restart you computer to make the preference active. Alternatively, if you don't want to change your computer preferences, you can specify an application to open the folder from the Alfred File Actions menu. When you are selecting a folder from Alfred, just press your File Actions key (the one(s) that you've defined in the Alfred preferences) and use "Open With" action and select the Marta application and it should open your folder in Marta.
  16. @Jasondm007 sorry, it seems I skipped your message, but to answer rapidly, yes that's pretty much what you need to do to change the action or application that will be run with the fileAlias. Simply change the line: tell application AppName to ActionToDoOn fileAlias
  17. @michaelwills sorry for the long delay! I got too much work on my side with no free time. Things are starting to settle down Sorry that the nofile.io link is not working anymore. Actually, I had a small update on my side that I needed to push here ;) So here it is: Update Version 1.2.5 What’s new: Cardhop Actions list should be in your own language (I’m getting the localization from the Cardhop application directly, so you should get the same thing as in the application) Some bugs fix Download link: https://d.pr/f/rQTPtu @michaelwills regarding the coffee, actually, I like pretty much all kind of coffee :) I’m not very difficult All the best!
  18. @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!
  19. 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
  20. 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+&amp;+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
  21. @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+&amp;+OCR_Keywords.alfredworkflow
  22. 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+&amp;+OCR_Keywords.alfredworkflow Let me know how it goes!
  23. 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
  24. @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+&amp;+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
  25. @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:
  • Create New...