mareoraft Posted December 11, 2013 Posted December 11, 2013 When I lookup a person on Alfred, the Alfred contacts pane shows up. I can then use arrow keys to select their name, email, phone number, etc. When I select their phone number and hit enter, I would like my Phone application (Telephone.app) to call that person. I have two proposed solutions, but don't know how to finish either fully... Use Alfred Preferences > Features > Contacts > + to add a custom action Then choose "Phone" for the Contact Field and "Pass URL to Scheme" for the Action and type "telephone:{query}" in the box. This would require me to create a URL Scheme for Telephone which calls the query. I don't know how to create a URL scheme and don't know if it's possible since I am not the developer of Telephone. The second option would be to create a Contact Trigger called "Call" in a workflow, and then select "Call" for the Action (instead of Pass URL to Scheme). The workflow will run an AppleScript which reads on alfred_script(q) tell application "Telephone" to activate tell application "System Events" to keystroke "a" using command down tell application "System Events" to keystroke "???" tell application "System Events" to keystroke return end alfred_script The problem is that I need ??? to be the phone number, and I don't know how to pull that information. When you set the Action to "Call" instead of "Pass URL to scheme", is there still a {query} i can somehow paste or access? Thanks so much for your help. Mareo
jdfwarrior Posted December 12, 2013 Posted December 12, 2013 When I lookup a person on Alfred, the Alfred contacts pane shows up. I can then use arrow keys to select their name, email, phone number, etc. When I select their phone number and hit enter, I would like my Phone application (Telephone.app) to call that person. I have two proposed solutions, but don't know how to finish either fully... Use Alfred Preferences > Features > Contacts > + to add a custom action Then choose "Phone" for the Contact Field and "Pass URL to Scheme" for the Action and type "telephone:{query}" in the box. This would require me to create a URL Scheme for Telephone which calls the query. I don't know how to create a URL scheme and don't know if it's possible since I am not the developer of Telephone. The second option would be to create a Contact Trigger called "Call" in a workflow, and then select "Call" for the Action (instead of Pass URL to Scheme). The workflow will run an AppleScript which reads on alfred_script(q) tell application "Telephone" to activate tell application "System Events" to keystroke "a" using command down tell application "System Events" to keystroke "???" tell application "System Events" to keystroke return end alfred_script The problem is that I need ??? to be the phone number, and I don't know how to pull that information. When you set the Action to "Call" instead of "Pass URL to scheme", is there still a {query} i can somehow paste or access? Thanks so much for your help. Mareo I signed up for a free account on one of the sip providers just to test stuff and also found documentation to back this up but, opening a link using sip: or tel: should work fine so.. your idea of creating a contact action should work fine. Just make the contact action do.. open tel:{query} or open sip:{query} where query would be the contacts info passed to it.
mareoraft Posted December 12, 2013 Author Posted December 12, 2013 Okay, I just tested entering "open sip:{query}" as the parameter for "Pass URL to scheme", and nothing. Then I just tested entering "sip:{query}" as the parameter for "Pass URL to scheme", and it activates Telephone! But does not input the query or dial The same goes for "tel" This seems promising though, and perhaps there is just a slightly more complicated url which makes it actually input the query? Can you post the link to the documentation? Now for the more complex method of using a Contact Action workflow... I tried putting "open sip:{query}" into the applescript, but i don't think it is even a valid applescript command. I'm not terribly familiar with applescript. As far as applescript goes, all I would need is a way to "tell application "System Events" to keystroke "{query}"" or something like that. But it seems this doesn't actually grab the query. I saw in one of your php scripts, you wrote "$in = "{query}";" to make a variable called "in" which was the content of query. I guess that's what I'm looking for, but for applescript. Let me know and thanks in advance!
mareoraft Posted December 13, 2013 Author Posted December 13, 2013 It seems that tel:{query} DOES WORK provided that the number in the addressbook (as written in the vCard file) has no parenthesis, spaces, or dashes. Is there some way I can perform RegExp or parsing on the query before passing it in order to strip the formatting away? maybe something like... tel:stripped({query})
jdfwarrior Posted December 13, 2013 Posted December 13, 2013 It seems that tel:{query} DOES WORK provided that the number in the addressbook (as written in the vCard file) has no parenthesis, spaces, or dashes. Is there some way I can perform RegExp or parsing on the query before passing it in order to strip the formatting away? maybe something like... tel:stripped({query}) When i said "open tel:" or "open sip:" I was referring to using it as a bash command. In this way, tel: and sip: are known schemes just like mailto:, http:, ftp:, etc. As far as your question about a regular expression here, and in the other post, if you were to grab the phone number using the contact action and setting it to the phone number field, just attach the Contact Action in the workflow to a Run Script item and run your regex there and then do "open" to run it.
mrgreen Posted March 29, 2014 Posted March 29, 2014 Hey guys Just want to push this thread as I cannot completely understand how to set up the workflow. Can anyone share his copy?
jdfwarrior Posted April 7, 2014 Posted April 7, 2014 Ditto Hey guys Just want to push this thread as I cannot completely understand how to set up the workflow. Can anyone share his copy? Create a workflow with a Trigger->Contact action and then attach a Run Script to the back end of it with the script set to be a bash script that does... open tel:{query} That is, assuming you have an application that has registered and uses the tel: url scheme
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