Jump to content

messages workflow and emojis


Recommended Posts

I've built a contact action to send contacts messages without opening messages, but for some reason if I use an emoji the emoji is turned into unicode (i think) characters.  

 

This is what the text should look like: "🤚testing:, but when using my workflow it comes out like this: "ü§ötesting"

 

 

here is my workflow:

image.thumb.png.9abcc132a9f10ebf2487a84f43e8ed14.png

 

 

 

image.thumb.png.1ec9c48b957cf0e9622b06b3b6253d3e.png

 

 

 

When I don't use a variables and just put a number directly into the script and pass the message as a {query} the script it will pass the emoji. Are arg/vars not capable or passing emojis or images?

 

image.thumb.png.b5e120521f71d97874a84f4aecb62277.png

 

 

image.thumb.png.8e5191bf690a774958101305bc459630.png

 

 

 

Edited by sepulchra
Link to comment
Quote

Are arg/vars not capable or passing emojis or images?

 

I have two workflows that send text to Messages and both can send emojis. Sorry that I've not had a chance to revise the script to achieve exactly what you're doing but what I use is this:

 

on run argv
	repeat with i from 1 to number of items in argv
		set textMessage to item i of argv
		tell application "Messages"
			set targetFriend to "xxxxxxxxxxx"
			set targetService to (id of 1st account whose service type = iMessage)
			set theFriend to participant targetFriend of account id targetService
			send textMessage to theFriend
		end tell
	end repeat
tell application "Messages"
	quit
end tell
end run

 

In my case the number is preset in the script but I imagine it's relatively easy to send the second argument as the telephone number of targetFriend.

 

As that works with emojis I'm wondering if the difference in coding may potentially be the solution.

 

(By way of further explanation my workflow simply uses a keyword to send what then follows as a message to the preset recipient.)

 

Stephen

Link to comment

What is the repeat step doing? the repeat i from 1 etc

 

And what is confusing to me is that the only difference in my workflows is the use of the arg/vars alfred objects. the one without the objects like yours also sends emojis. I'm puzzled.

 

 

Edited by sepulchra
Link to comment
17 minutes ago, sepulchra said:

What is the repeat step doing? the repeat i from 1 etc

Nothing at present, as there's only one argument. This was a very early workflow/script that I wrote and I've resolved to update it tomorrow (when I have more time) to make more sense of it. I'll experiment a little tomorrow and see if I can get something more along the lines of your script working.

 

I've certainly succeeded in passing arguments to Messages (for recipient and message) using an Open URL action with the URL in the following form

 

imessage://{var:recipient}&body={var:theMessage}

 

and that will send emojis.

 

(Sorry for these hasty replies: not much time just now!)

 

Stephen

Link to comment

Sorry for the hasty and less than helpful responses yesterday! I've now been able to do some more work and can confirm the result you discovered with your first workflow variant. I see exactly the same problem with emojis when using that form of workflow.

 

As a result I prefer to use this workflow:

 

AlfredPreferences-AlfredPreferences-02-04-2023-at06_47.28@2x.thumb.png.9a32b79fde5329b73a01c00c6d24fad1.png

 

The script is as follows:

 

on run argv
  set targetFriend to item 1 of argv
  set textMessage to item 2 of argv
    tell application "Messages"
      set targetService to (id of 1st account whose service type = iMessage)
      set theFriend to participant targetFriend of account id targetService
      send textMessage to theFriend
    end tell
  tell application "Messages"
    quit
  end tell
end run

 

Obviously there are some differences between what you did and what I have done:

  • I have a list filter listing various friends' numbers.
  • At the end of my script I've added a quit command to Messages to emulate what you were trying to do (i.e., send messages without opening Messages)—but I find the end result very similar to yours.

I hope this is a rather more helpful than yesterday's posts. 😀

 

Stephen

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...