Problem sending iMessages with AppleScript...

Posted on
Wed Mar 27, 2019 12:24 am
russg offline
Posts: 46
Joined: Oct 02, 2014

Problem sending iMessages with AppleScript...

Hi All,
I copied the script below for sending text. messages via AppleScript in an Action. (I'm not using the iMessage plugin because of problems getting it to work). Here's my code:
=======
Code: Select all
use application "IndigoServer"
set pvSubject to value of variable "vTxtMsgSubject"
set pvMessage to value of variable "vTxtMsgBody"
set pvBuddy to value of variable "vTxtMsgBuddy"

set targetMessage to "{Indigo} " & pvSubject & " " & pvMessage
tell application "Messages"
   set targetService to 1st service whose service type = iMessage
   set targetBuddy to buddy pvBuddy of targetService
   send targetMessage to targetBuddy
end tell
========
This works great EXCEPT if the message app on the system running Indigo does NOT ALREADY HAVE a message from the buddy the script is trying to send to. This is an issue if you are adding a new phone number to send the message to, or if the string of messages from the recipient on the Indigo system have all been deleted.

Basically, there is no existing Buddy to reference. There would need to be a way to specify a NEW Buddy, somehow.

Is there a way to send a message using AppleScript that would work in these cases? I.e. the AppleScript is trying to send to a phone number that is not in the list of existing messages.

Any thoughts? I'd be willing to take on a Python script if it would work in both cases.

thanks in advance!
-russg

Posted on
Wed Mar 27, 2019 8:12 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Problem sending iMessages with AppleScript...

[MODERATOR NOTE] I don't know the answer but I moved the topic to the (more appropriate) AppleScript Scripting forum.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 27, 2019 2:38 pm
mat offline
Posts: 769
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Problem sending iMessages with AppleScript...

Have you tried the plugin? Works for me.

Late 2018 mini 10.14

Posted on
Wed Mar 27, 2019 5:49 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Problem sending iMessages with AppleScript...

FWIW, I've been using the "Messages" plugin.

https://github.com/gazally/indigo-messages


Works great for me and may be something you can use.

Posted on
Thu Mar 28, 2019 10:14 pm
russg offline
Posts: 46
Joined: Oct 02, 2014

Re: Problem sending iMessages with AppleScript...

I spent several hours playing with it, but I kept getting strange behaviors that crept up after porting Indigo from a VMWare virtual machine on an old Mac to a different physical Mac, w/o the VM.

It looks simple, there isn't much configuration, and I'd prefer to use it but I ran out of time and went with this. When I get a couple of free hours I'll take a look again; the developer has been great at answering questions and it would be ideal.
thanks - rush

Posted on
Wed May 22, 2019 3:31 pm
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Problem sending iMessages with AppleScript...

I'm not positive... I only send messages to myself and my wife... but the only difference between your script and mine is of (service 1 whose service type is iMessage).

Code: Select all
tell application "Messages"
   set targetService to 1st service whose service type = iMessage
   set targetBuddy to buddy pvBuddy of targetService
   send targetMessage to targetBuddy of (service 1 whose service type is iMessage)
end tell


Just came across this while trying to figure out how to convert my applscript iMessage to Python iMessage.

Bill
My Plugin: My People

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests