Jump to content

Recommended Posts

3oEjI8h47F0lZvTc88.gif

I was unhappy with the Alfred support for Continuity/Handoff calling via iPhone so I created this. It integrates with contacts. Use commands

call [contact name or arbitrary number]

 and 

sms [contact name or arbitrary number]

 to make it work. 'im' is an alias of 'sms'. 

 

New in version 2

  • Faster than before
  • Supports entering in numeric numbers also
  • Now has primitive error checking. You should see the Facetime application pop up less.
  • More hack-able
  • FIXED: If Contacts isn't open when the command is invoked it will now close itself afterwards.
  • Requires Alfred 3.

typing.png

initcall.png

58b623ce3c6d5_callorsmscontact.png.7f50700e481247495f119da14c187775.png

Download from Github.

Download from Packal.

Edited by amoose136
update workflow image
Link to comment

Hi.

This workflow looks very good. But not work with my czech number.

I have contacts with numbers "+420 XXX XXX XXX" format so its 12 numbers.

It was designed for use in the US but  it should be easy to change for other countries. The two yellow magnifying glasses check length. The top one checks for numbers of length 7 (xxx-xxxx) plus an optional 3 or 4 digits in front for country codes (+x-(xxx)-..., (xxx)-....). The for text messages area codes are required in the US so it only checks that numbers are 10 or 11 digits long. (+x-(xxx)-xxx-xxxx or (xxx)-xxx-xxxx). You should be able to modify the parts in the brackets to make it work for Czech numbers or anywhere else in the world. Another option is to just by pass the error checking and send the number directly to the scripts at the end after the uncolored magnifying glasses. If an improper number is dialed facetime will pop up or if you try to text it you will get a failed to send message.

Link to comment

Hallo!

 

Thanks for this workflow. Just a problem here: I can't figure how to send SMS...

I tried the following:

**A**

call Alfred and write "sms [contact name]" ENTER

--> nothing happens (iMessage doesn't even open)

 

**B**

call Alfred and write "sms [contact number] test message" ENTER

--> again nothing happens

 

No error message, nothing at all.

Strange enough: it seems that telephone calls correctly begin...

Running MacBook Pro OSX 10.11.5 + iPhone 6 iOS 9.3.3, both in italian (maybe this is the point?)

Edited by Hileotech
Link to comment

Hallo!

 

Thanks for this workflow. Just a problem here: I can't figure how to send SMS...

I tried the following:

**A**

call Alfred and write "sms [contact name]" ENTER

--> nothing happens (iMessage doesn't even open)

 

**B**

call Alfred and write "sms [contact number] test message" ENTER

--> again nothing happens

 

No error message, nothing at all.

Strange enough: it seems that telephone calls correctly begin...

Running MacBook Pro OSX 10.11.5 + iPhone 6 iOS 9.3.3, both in italian (maybe this is the point?)

The proper usage is in **A**. Numbers must be formatted with 10 or 11 digits as per US rules but it's easily changed to suit your region. If you type

im 1234567890

or

im 12345678901

or

sms 1234567890

or

sms 12345678901 

or assuming Franz Schubert is in your contacts and has a number containing 10 or 11 digits once other characters are removed,

sms Franz Schubert 

or

im Franz Schubert

It should work. I don't know why no error message appeared though. I might make it possible to set your area code/region in the future and then it will prepend your area code when texting if it's not present in the number and it could also adjust standard number length by region based on that area code and country code stored in environmental variables. That will have to wait for the next version though.

Link to comment

Well: thanks for your help.

I have all contacts formatted as follows:

 

Name Surname

+39 [italian international prefix] 123 4567890

 

I changed the rule in order to accept 12 or 13 digits.

The problem, as I told you, is that Message doesn't even open... I'll try again in a few hours and report back.

:)

Link to comment

I also have an issue that when trying to send texts or place calls, after entering the info and selecting recipient or typing full number, nothing happens. No error, Messages does not open, messages are not sent. The previous version worked perfectly.

 

I would summon Alfred

 

type - im Tonya (or full phone number)

 

hit return

 

type message

 

hit return and message was sent without focusing on the Messages app, and giving me an alert message back saying that the message was sent.

 

 

In this version, I get nothing at all. Am I doing something wrong?

Link to comment

I get the same problem. Nothing opens when I go through the exact steps that antisyphus goes through.

 

I also have an issue that when trying to send texts or place calls, after entering the info and selecting recipient or typing full number, nothing happens. No error, Messages does not open, messages are not sent. The previous version worked perfectly.

 

I would summon Alfred

 

type - im Tonya (or full phone number)

 

hit return

 

type message

 

hit return and message was sent without focusing on the Messages app, and giving me an alert message back saying that the message was sent.

 

 

In this version, I get nothing at all. Am I doing something wrong?

Link to comment

I also have an issue that when trying to send texts or place calls, after entering the info and selecting recipient or typing full number, nothing happens. No error, Messages does not open, messages are not sent. The previous version worked perfectly.

 

I would summon Alfred

 

type - im Tonya (or full phone number)

 

hit return

 

type message

 

hit return and message was sent without focusing on the Messages app, and giving me an alert message back saying that the message was sent.

 

 

In this version, I get nothing at all. Am I doing something wrong?

All that should happen when you type 

im Tonya

or use a phone number is it should open Messages with a message to Tonya in focus. If messages doesn't open then typing the message and hitting enter will do nothing. Out of curiosity, what happens if you route the immediate output of the bottom triggers (just before the save initial query block but after the applescript block) to a "Display Big Type" output? If nothing displays it's very broken indeed. It should display the number but all the formatting should be there. If that works then check the output at the "saved cleaned query" step. I currently am unable to make it not do anything on my computer and until I can replicate the error I'm afraid I won't be much help.

Edited by amoose136
Link to comment

I love this workflow man, thanks!

 

 

I only have one "bug" to report:

 

Whenever I type "SMS [contact name]", it goes to the messages app and it opens the dialog window for that person, ready to type and send a text message. As it should, no problem there.

 

 

But then I noticed:

 

When the messages app is open and the contact person's dialog window is already in focus, the same command via Alfred: instead of using the text number, it changes to iMessage mode and I can't send a text as it wants to use imessage instead. (contact doesn't have an iphone)

 

Maybe you could implement a check that, if the person already is in focus, stop looking or something. I dunno, I'm not a programmer :)

 

 

I can make a video of the problem if you want, it's nothing major but it upsets the goal of the workflow though.

Edited by squandre
Link to comment

I love this workflow man, thanks!

 

 

I only have one "bug" to report:

 

Whenever I type "SMS [contact name]", it goes to the messages app and it opens the dialog window for that person, ready to type and send a text message. As it should, no problem there.

 

 

But then I noticed:

 

When the messages app is open and the contact person's dialog window is already in focus, the same command via Alfred: instead of using the text number, it changes to iMessage mode and I can't send a text as it wants to use imessage instead. (contact doesn't have an iphone)

 

Maybe you could implement a check that, if the person already is in focus, stop looking or something. I dunno, I'm not a programmer :)

 

 

I can make a video of the problem if you want, it's nothing major but it upsets the goal of the workflow though.

Thanks for the report. I can replicate the behavior but it's not so clear how to fix it. It would probably require some sort of AppleScript to be inserted just before the result block but I don't know if I can check if the contact/number is already open or not. I'll investigate more into the matter.

Link to comment
  • 8 months later...

As of the most recent update today (2.2), the number format checking has been removed. Adding it was based on some falsehoods.  I also implemented a workaround for an Apple Event Handler failure that occasionally appears in recent macOS updates and causes FaceTime to open instead of contact calling to happen. A complete python rewrite is in the works to fix some of the bigger issues.

Edited by amoose136
forgot link
Link to comment
  • 3 years later...
  • 3 weeks later...
  • 2 months later...

Not sure if it will work for everyone but when I reinstalled it, I got an alert about an outdated bit of python which led to

https://www.alfredapp.com/help/troubleshooting/incompatible-python-workflow-library/

 

seems to be working again for me, previously it would just launch facetime and stop.

 

 

 

Link to comment
3 hours ago, nilsdog said:

I just deleted the workflow, redownloaded it, then ran @deanishe 's Fixum to update the workflow, and it still just opens FaceTime

 

Fixum won't fix it: it only fixes some problems in a library that are unrelated to the workflow's own functionality.

 

"It still just opens FaceTime" isn't an actionable description of a problem. Check Alfred's debugger. See if there's an error being reported. Check if FaceTime is being called with an actual name or number.

Link to comment

ok sure, thanks @deanishe

 

Sorry for the lack of descriptive info.

 

Debug Mode yielded the below:

 

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

 

[5:23:37.102 pm] Logging Started...

[5:24:24.267 pm] Call or SMS contact[File Filter] Processing complete

[5:24:24.279 pm] Call or SMS contact[File Filter] Passing output '/Users/nilsdog/Library/Application Support/AddressBook/Sources/F134E7C6-4FAC-4032-A80C-CF0779BA2841/Metadata/71E705CA-9CC6-4801-B529-9240EBF0BB5C:ABPerson.abcdp' to Arg and Vars

[5:24:24.280 pm] Call or SMS contact[Arg and Vars] Processing complete

[5:24:24.280 pm] Call or SMS contact[Arg and Vars] Passing output '/Users/nilsdog/Library/Application Support/AddressBook/Sources/F134E7C6-4FAC-4032-A80C-CF0779BA2841/Metadata/71E705CA-9CC6-4801-B529-9240EBF0BB5C:ABPerson.abcdp' to Run NSAppleScript

[5:24:24.312 pm] ERROR: Call or SMS contact[Run NSAppleScript] {

    NSAppleScriptErrorAppName = "Alfred 4";

    NSAppleScriptErrorBriefMessage = "The file /Applications/Contacts.app does not exist.";

    NSAppleScriptErrorMessage = "The file /Applications/Contacts.app does not exist.";

    NSAppleScriptErrorNumber = 1;

    NSAppleScriptErrorRange = "NSRange: {297, 60}";

}

[5:24:24.317 pm] Call or SMS contact[Run NSAppleScript] Processing complete

[5:24:24.317 pm] Call or SMS contact[Run NSAppleScript] Passing output '' to Replace

[5:24:24.318 pm] Call or SMS contact[Replace] Processing complete

[5:24:24.318 pm] Call or SMS contact[Replace] Passing output '' to Run Script

[5:24:24.546 pm] Call or SMS contact[Run Script] Processing complete

[5:24:24.550 pm] Call or SMS contact[Run Script] Passing output '' to Filter

 

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

 

Not sure why it's telling me the contacts app doesn't exist, as I can see it in my applications folder?

 

I guess I would need to update the applescript's path for where contacts is, but it looks correct from what I can see:

 

–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

 

on alfred_script(q)

-- {sys1, sys2, sys3 } = { major, minor, bugfix}
set minor_ver to system attribute "sys2" 

set contacts_running to false
if application "Contacts" is running then
 set contacts_running to true
else
	-- Catalina (10.15) moved the location of Contacts.app
	if 14 ≤ minor_ver then
		do shell script "open -j /Applications/Contacts.app"
	else
		do shell script "open -j /System/Applications/Contacts.app"
	end if
end if

tell application "Contacts"
 set q to text ((offset of "Metadata/" in q)+9) thru ((offset of "." in q)-1) of q
 set phonenumber to value of phone of person id q
 set phonenumber to item 1 of phonenumber
end tell

if contacts_running is false
 tell application "Contacts" to quit
end if

return phonenumber
end alfred_script

 

I know this is nothing to do with you (so thank you for your previous response), but if you have a moment; any thoughts?

Link to comment
2 hours ago, nilsdog said:

Not sure why it's telling me the contacts app doesn't exist, as I can see it in my applications folder?

 

If you’re using Catalina, then no it doesn’t. It’s actually in /System/Applications. Finder lies a lot about where files actually are and what they're called. Go check /Applications in Alfred or Terminal.

Link to comment

Ahh, I see. You were correct - the script was referencing the wrong location. Thanks @deanishe !

 

For anyone that stumbles across this and wants a fix, I simply deleted the nested if statement within the first NSApplescript (found in the workflow object window) – this made it work for me.

 

on alfred_script(q)

-- {sys1, sys2, sys3 } = { major, minor, bugfix}
set minor_ver to system attribute "sys2" 

set contacts_running to false
if application "Contacts" is running then
 set contacts_running to true
else
	-- Catalina (10.15) moved the location of Contacts.app
	if 14 ≤ minor_ver then
		do shell script "open -j /Applications/Contacts.app"
	else
		do shell script "open -j /System/Applications/Contacts.app"
	end if
end if

tell application "Contacts"
 set q to text ((offset of "Metadata/" in q)+9) thru ((offset of "." in q)-1) of q
 set phonenumber to value of phone of person id q
 set phonenumber to item 1 of phonenumber
end tell

if contacts_running is false
 tell application "Contacts" to quit
end if

return phonenumber
end alfred_script
Link to comment
2 hours ago, nilsdog said:

I simply deleted the nested if statement within the first NSApplescript (found in the workflow object window) – this made it work for me.

 

Yeah. The script is apparently trying to check for Catalina, but those sys variables don’t actually exist.

 

I think it’s unnecessary, anyway. You can just run open -j -a Contacts and it will work regardless of where the application is.

 

Link to comment
  • 3 months later...
  • 2 weeks later...
On 11/17/2020 at 1:38 PM, hugobert said:

After installing Big Sur the iMessage workflow I used since 2013 broke, so I started looking for an alternative workflow.

This one looks promising, but sadly its not working with Big Sur.

If I type im or sms and the phone number it works fine but with im or sms and the contact name it opens the messages app and starts a new message to an unspecified contact.

 

Would love to get this one working.

 

Interesting....It seems to be working okay for me on Big Sur. I, too, had been using a different workflow "iMessage to Friend" multiple times a day for years and years. It doesn't work with Big Sur, unfortunately.

 

The biggest difference with this one, is that before I could literally type my message in the Alfred pop up window. This workflow, while great, only seems to open up the contact I type in Messages. I then have to have exit out of the Alfred window to begin typing my message. Is there a way to actually type the message in the initial window?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...