GuiB Posted October 31, 2017 Share Posted October 31, 2017 (edited) 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! Edited January 15, 2023 by GuiB Updated the download link to version 1.2.5 cands, Ehler, Neberheim and 3 others 6 Link to comment
GuiB Posted November 1, 2017 Author Share Posted November 1, 2017 (edited) 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 Edited November 8, 2017 by GuiB Link to comment
able Posted November 2, 2017 Share Posted November 2, 2017 Wow, GuiB, this workflow is a DREAM. Exactly what I hoped would happen with Alfred, and enough to push me over into buying Cardhop after the trial. Thank you for making it! Link to comment
GuiB Posted November 2, 2017 Author Share Posted November 2, 2017 @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 Link to comment
GuiB Posted November 6, 2017 Author Share Posted November 6, 2017 (edited) 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 Edited November 8, 2017 by GuiB cands 1 Link to comment
GuiB Posted November 8, 2017 Author Share Posted November 8, 2017 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 Link to comment
politicus Posted January 7, 2018 Share Posted January 7, 2018 @Guib I wanted to thank you for your time before diving into what seems like to be a masterpiece ! Link to comment
GuiB Posted January 8, 2018 Author Share Posted January 8, 2018 @politicus, hey, thanks for the kind words! This is really appreciated! Link to comment
Eukaryote Posted April 4, 2018 Share Posted April 4, 2018 Me: "I don't think that learning how to set up workflows and scripts is going to be that difficult." Also me: [spits out coffee] Thanks for making this! Link to comment
cands Posted April 30, 2018 Share Posted April 30, 2018 This workflow is great! I have one issue though: Cardhop crashes when sending a command including any Swedish characters (å, ä, and ö), e.g. 'chs text jönsson'. Cardhop works fine if I write the same command ('text jönsson') directly into the application, so I figure that the crash is related to how the workflow treats international characters. I guess users working in other languages may be affected, too, so it would be great if this can be fixed (I'm using version 1.2.1 of the workflow with Alfred 3.6.1 on macOS 10.13.4). Link to comment
deanishe Posted April 30, 2018 Share Posted April 30, 2018 31 minutes ago, cands said: I guess users working in other languages may be affected, too English, too, tbh. The workflow is failing because it’s trying to use encoded strings, but Python’s json module is Unicode. So it dies in flames when given non-ASCII input. At minimum, every query variable needs decoding. Ideally, all Python strings should be converted to Unicode strings, not encoded strings. Link to comment
GuiB Posted April 30, 2018 Author Share Posted April 30, 2018 @cands , yes this was a problem with unicode encoding. Here is a new version that should fix the issue (it's working on my side, let me know if you get any other issues!) https://nofile.io/f/RtSBb1n8st5/gbCardhop.alfredworkflow @deanishe, it didn't seem to cause problems with the json output, but more to Cardhop since I tried normalizing the output that sends to Cardhop and it was working as well, but I now normalize the inputs to make sure and it's working also. The problem seemed more that Cardhop want NFC type of unicode or crash Link to comment
GuiB Posted April 30, 2018 Author Share Posted April 30, 2018 @Eukaryote, haha thanks Actually, you can make a workflow for Cardhop with just a simple Open URL object and a Keyword object to set a string to send, but I wanted to add more features than simply passing the string to Cardhop Also, I'm sure there could be a method with less connections, but I've been using this kind of message passing with filtering and find it's working quite well. Best wishes in trying to learn how to make workflows! Link to comment
deanishe Posted April 30, 2018 Share Posted April 30, 2018 38 minutes ago, GuiB said: @deanishe, it didn't seem to cause problems with the json output, but more to Cardhop since I tried normalizing the output that sends to Cardhop and it was working as well, but I now normalize the inputs to make sure and it's working also. The problem seemed more that Cardhop want NFC type of unicode or crash I’m sure you’re right. I was just looking at the code in info.plist on my iPad, so I didn’t have any real context. I also can’t remember whether Andrew added PYTHONIOENCODING to Alfred, which would affect the behaviour. Weird that it would want NFC considering macOS prefers NFD. Link to comment
cands Posted April 30, 2018 Share Posted April 30, 2018 2 hours ago, GuiB said: @cands , yes this was a problem with unicode encoding. Here is a new version that should fix the issue (it's working on my side, let me know if you get any other issues!) https://nofile.io/f/RtSBb1n8st5/gbCardhop.alfredworkflow I did some brief tests and can confirm that it seems to be working fine now with Swedish characters, thanks very much for the quick update! Link to comment
Mightymuke Posted May 6, 2018 Share Posted May 6, 2018 There's a minor bug in your workflow. You need to import unicodedata into your cha script filter. This is stopping the actions list from working. Thanks for the workflow though - awesome. Link to comment
GuiB Posted May 6, 2018 Author Share Posted May 6, 2018 @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 cands 1 Link to comment
michaelwills Posted February 6, 2019 Share Posted February 6, 2019 This looks like a great workflow @GuiB but the link nofile.io link is a 404 currently. Link to comment
michaelwills Posted February 16, 2019 Share Posted February 16, 2019 I see this one is still available from https://www.alfredforum.com/topic/10917-cardhop-workflow/?do=findComment&comment=56437 https://nofile.io/f/ObcZMuqzaGT/gbCardhop.alfredworkflow Looking forward to trying this out! Link to comment
michaelwills Posted February 16, 2019 Share Posted February 16, 2019 @GuiB What kind of coffee do you like? Link to comment
GuiB Posted February 24, 2019 Author Share Posted February 24, 2019 @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! James Hahn II 1 Link to comment
Kamil Posted January 15, 2023 Share Posted January 15, 2023 I am having trouble using this workflow. chc does not work, and for all other functions I get this popup: (I could not find a git repo for this workflow) Any help? I'd love to get this workflow to work.. Link to comment
GuiB Posted January 15, 2023 Author Share Posted January 15, 2023 4 minutes ago, Kamil said: I am having trouble using this workflow. chc does not work, and for all other functions I get this popup: (I could not find a git repo for this workflow) Any help? I'd love to get this workflow to work.. Yes I need to update the Workflow to use Python3 instead of 2. I did install Python 2 on my computer to make multiple of my workflows work again since I moved my OS version, but yes I need to do an update to this one and share it so anyone can keep using it I'll have a look as soon as possible. My days are very busy since many months, but I should manage to do it soon! As for the "chc" keyword, can you give me more input on your problem with this one? Do you have any error message? This is using standard Alfred objects and scanning the standard address book directory "~/Library/Application Support/AddressBook". I would think this should still work and I'm not having a problem with it on my side. I'll think some more and try to determine what it could be! Link to comment
GuiB Posted January 15, 2023 Author Share Posted January 15, 2023 Well, I just had a rapid look at it... Here is an updated one that work with Python3. Yes, I need to do a git repo and push it to the Alfred Gallery, but here is an updated version if you want to try and let me know if it works on your side! Download: https://d.pr/f/SX4Sn7 Link to comment
Kamil Posted January 15, 2023 Share Posted January 15, 2023 4 hours ago, GuiB said: Well, I just had a rapid look at it... Here is an updated one that work with Python3. Yes, I need to do a git repo and push it to the Alfred Gallery, but here is an updated version if you want to try and let me know if it works on your side! Download: https://d.pr/f/SX4Sn7 Hey! I'm testing it right now. chs works properly now, so Python3 should be working as intended. chc does not work: https://imgur.com/a/O0QoNQt I have the correct URL handler though: x-cardhop://show?id={uid} in Contacts/Advanced. 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