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

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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.

:)

Share this post


Link to post

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?

Share this post


Link to post

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?

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

Hi there,

 

This is not working for me. After selecting 'call' (contact), it simply opens FaceTime with no actions. Is this a permissions issue?

Share this post


Link to post

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.

 

 

 

Share this post


Link to post

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

 

Not sure what else to do to make this work.

 

@pete826 what response are you getting?

 

Is it calling the contact via tethering or does it try to FaceTime them?

Share this post


Link to post
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.

Share this post


Link to post

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?

Share this post


Link to post
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.

Share this post


Link to post

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

Share this post


Link to post
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.

 

Share this post


Link to post
On 7/9/2020 at 8:49 AM, deanishe said:

 

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.

 

 

 

I am the current maintainer for this as plug-in as of last year or so, so thank you for this. I only had the section in there for supporting legacy system I could not test on. I will switch this to the suggested command, and give you credit for it. 

 

Thank you. 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...