@dudeslife Posted December 4, 2013 Share Posted December 4, 2013 I use Airmail and i was having problems with the "mailto" option. it was pulling the contact and plugging in <name <name@mail.com>> in the To: field. As this is not a valid e-mail address format I was having to change it manually. If you are having the same problem, I modified line 123 in the mailto.py code. it should read: return u'{}'.format(email) this now places the correct format in the To: field name <name@mail.com> hope this helps someone. Link to comment
Jb_Bryant Posted December 4, 2013 Share Posted December 4, 2013 0.1642 seconds is pretty fast when you're running a shell script once, but Alfred calls it (if it can) every time you type a letter. In those terms, it's really rather slow. (And it runs much slower still when Alfred is calling it to search for just one or two letters.) By way of comparison, using a query that takes a similar length of time on my computer (0.1541 s), the original workflow's search takes 0.002 s, and it's doing more work (searching groups, too). I've made a test workflow for the all-accounts search here. Give it a try and see what you think of the performance. I'll work on speeding it up as much as I can, but if I can't get it at least 10-20x faster, I'll make it an option/separate workflow. It is a little slower but I don't mind personally just because it does what I need. Others may disagree though. I did my best to show you the speed without showing you my contacts' details: http://cl.ly/1I2t1l3K251m Link to comment
deanishe Posted December 4, 2013 Author Share Posted December 4, 2013 (edited) I use Airmail and i was having problems with the "mailto" option. it was pulling the contact and plugging in <name <name@mail.com>> in the To: field. As this is not a valid e-mail address format I was having to change it manually. If you are having the same problem, I modified line 123 in the mailto.py code. it should read: return u'{}'.format(email) this now places the correct format in the To: field name <name@mail.com> hope this helps someone. The problem is a known one. There's no need to change the code, just run mailtoconfig in Alfred and either specifically set Airmail as your client (the workflow knows Airmail only accepts email addresses, no names) or change the format to Email Only. This is no longer true. The workflow can now discover which email client you have set as system default and adjust its output accordingly. Note: the workflow will still send Name and Email if you've specifically set that format. I've updated the original post to draw attention to this problem. Edited February 2, 2014 by deanishe Link to comment
deanishe Posted December 4, 2013 Author Share Posted December 4, 2013 It is a little slower but I don't mind personally just because it does what I need. Others may disagree though. I did my best to show you the speed without showing you my contacts' details: http://cl.ly/1I2t1l3K251m I'll see what I can do. Thing is, it's going to get slower: it needs to search groups, too, which it isn't currently doing. Ideally, I'd be able to cache the contacts database like I do now, but it takes 3–5 seconds to load all contacts this way vs 0.05 seconds the current way. Link to comment
deanishe Posted December 6, 2013 Author Share Posted December 6, 2013 *bump* Another update. No new features as such, but now recognises which email client you're using (i.e. no need to set one in the workflow), and comes with fairly robust support for most of the popular Mac email clients. That is to say, no more problems with Airmail, MailMate or contacts with commas or diacritics in their names. If your email client of choice isn't listed in the OP and/or isn't working properly, please let me know. Obviously, that applies to problems with listed email clients, too Link to comment
deanishe Posted December 6, 2013 Author Share Posted December 6, 2013 I use Airmail and i was having problems with the "mailto" option. it was pulling the contact and plugging in <name <name@mail.com>> in the To: field. As this is not a valid e-mail address format I was having to change it manually. If you are having the same problem, I modified line 123 in the mailto.py code. it should read: return u'{}'.format(email) this now places the correct format in the To: field name <name@mail.com> hope this helps someone. Fairly hefty update today. Any and all problems with Airmail should be things of the past. Link to comment
nickwild Posted December 20, 2013 Share Posted December 20, 2013 Fairly hefty update today. Any and all problems with Airmail should be things of the past. This is a wonderful workflow. What would be extra specially great would be to select the account it was being sent from. I have 3 email addresses I use so it would be great to say "mailto paul with acct1name" Is this possible? Link to comment
deanishe Posted December 20, 2013 Author Share Posted December 20, 2013 I'm afraid that's not possible, as it isn't supported by the mailto protocol the workflow uses. Some email clients enable you to specify a sender when called via AppleScript, but they don't provide a way to see which sender addresses they know about … Link to comment
dpyy Posted December 23, 2013 Share Posted December 23, 2013 How do you install this workflow? Mine doesn't work. It installs fine, but when I type mailto and then enter it does nothing. Is there another software I need to install first? Link to comment
deanishe Posted December 30, 2013 Author Share Posted December 30, 2013 It should work as is. Does it show any options? Should look like this (before you hit ENTER). Link to comment
rice.shawn Posted January 27, 2014 Share Posted January 27, 2014 If you're still worried about speed on the Exchange contacts query, then consider putting in a minimum number of characters to search before the script filter "fires." I.e. if the "argument" has fewer than three characters, return some xml that says "type more characters to search" or something. Then it won't grab quite as many results (results for the "t" would be much bigger and slower than "tom"), and it won't get caught up doing those first two searches, making the overall thing faster. If you want to get much, much fancier, then you could consider caching the query results for some amount of time. Link to comment
albertkinng Posted January 29, 2014 Share Posted January 29, 2014 nothing is happening with me. I downloaded the file double click to install and try it but I don't know what is going on it just shoots me to a blank webpage (I'm using Safari) any help. Link to comment
deanishe Posted January 29, 2014 Author Share Posted January 29, 2014 nothing is happening with me. I downloaded the file double click to install and try it but I don't know what is going on it just shoots me to a blank webpage (I'm using Safari) any help. I just downloaded the workflow myself using Safari and it installed just fine. Could you verify that you're downloading a file called "MailTo.alfredworkflow" that is 197 KB in size? Link to comment
deanishe Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) If you're still worried about speed on the Exchange contacts query, then consider putting in a minimum number of characters to search before the script filter "fires." I.e. if the "argument" has fewer than three characters, return some xml that says "type more characters to search" or something. Then it won't grab quite as many results (results for the "t" would be much bigger and slower than "tom"), and it won't get caught up doing those first two searches, making the overall thing faster. If you want to get much, much fancier, then you could consider caching the query results for some amount of time. The problem is that even with 3+ character queries, search takes ~0.2 seconds, which I consider to be unacceptably slow. I imagine a lot of people have significantly more contacts than I do, too. At the moment I'm experimenting with re-writing the workflow in Objective-C to get full speed out of the native API. Unfortunately, it's still a lot slower than the current implementation and the search is far more rudimentary. Are there any volunteers who I could send a proof-of-concept version to, so they can confirm whether it works with Exchange contacts, too? The Apple API docs say: Note: You can only search the user’s local Address Book database, not remote directories such as CardDAV or Exchange. However, Jb_Bryant reported that his Exchange contacts were showing up in the Python version that uses the official API (via a bridge). Edited January 29, 2014 by deanishe Link to comment
Jb_Bryant Posted January 30, 2014 Share Posted January 30, 2014 Would there be any way to use Gmail in Chrome as the default method with this workflow? That way I could use Outlook as my default system-wide and use the built in contact search in Alfred for that. And then use this workflow to send through Gmail since all of my iCloud and Gmail contacts show up with this workflow. Link to comment
Jb_Bryant Posted January 30, 2014 Share Posted January 30, 2014 I see now that in your original post it says it should work if you choose Chrome as the mail client. That didn't work in the old workflow. It would just open up a blank tab in Chrome. I just upgraded to the latest version and it actually doesn't work at all. I type mailtoclient, hit enter, and it goes to my fallback google search. Link to comment
deanishe Posted January 30, 2014 Author Share Posted January 30, 2014 Have you enabled Gmail as an email client yet? It won't work if you haven't done that. I'm afraid I can't replicate the mailtoclient error. What happens when you TAB on it? Link to comment
Jb_Bryant Posted January 30, 2014 Share Posted January 30, 2014 Ah that makes sense. Nothin happens when I tab on it. Link to comment
deanishe Posted January 30, 2014 Author Share Posted January 30, 2014 To enable Gmail, open it in Chrome and hit the overlapping squares icon in the location bar. With regard to the configuration problem, could you open the workflow directory in Terminal and run: python mailto.py client If you could PM me the output, I can try to fix it. If there is no output, run: python mailto.py logon Then once more: python mailto.py client And finally: python mailto.py openlog And PM me the contents of the log instead. Link to comment
ctwise Posted February 3, 2014 Share Posted February 3, 2014 The plutil parsing of com.apple.LaunchServices.plist fails on my system with an error "invalid object in plist for destination format". My file contains a '<data>' field for the LSHighResolutionModeIsMagnified key. Link to comment
deanishe Posted February 3, 2014 Author Share Posted February 3, 2014 (edited) Jb_Bryant is having similar problems. It's an Apple utility choking on an Apple file … I'm looking into a workaround. Thanks for the feedback. Edited February 3, 2014 by deanishe Link to comment
deanishe Posted February 3, 2014 Author Share Posted February 3, 2014 The plutil parsing of com.apple.LaunchServices.plist fails on my system with an error "invalid object in plist for destination format". My file contains a '<data>' field for the LSHighResolutionModeIsMagnified key. Had a poke around, and it looks like exporting the plist as XML, not JSON, should fix the problem. I'll try and get that changed tomorrow (well, later today, I guess) and upload a new version. Thanks for the testing and explicit error message. It was very helpful. Link to comment
dpyy Posted March 24, 2014 Share Posted March 24, 2014 Is there any update on this? I really need this workflow really bad. Here's my output if it helps. python mailto.py client Traceback (most recent call last): File "mailto.py", line 62, in <module> from contacts import get_contacts, CACHEPATH File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/contacts.py", line 29, in <module> log = logger(u'contacts') File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/log.py", line 24, in logger s = Settings() File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/settings.py", line 49, in __init__ self._load() File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/settings.py", line 60, in _load self['system_default_app'] = self._get_system_default_client() File "/Users/G/Dropbox/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.7E8973CB-6BB8-4137-B64E-1480BAE6661E/settings.py", line 75, in _get_system_default_client d = json.loads(check_output(command)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 575, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '[u'plutil', u'-convert', u'json', u'-o', u'-', u'/Users/G/Library/Preferences/com.apple.LaunchServices.plist']' returned non-zero exit status 1 Link to comment
dirk Posted March 24, 2014 Share Posted March 24, 2014 @dpyy: I had the same problem and I have rebuild the com.apple.LaunchServices.plist file (delete and restart the mac). After this I had to re-set some settings, but it works. Link to comment
deanishe Posted March 24, 2014 Author Share Posted March 24, 2014 Sorry, my bad I fixed the problem but never uploaded the fixed version (I just mailed it to people having the problem). If you download the workflow again, the problem should be fixed. 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