I'm trying to check if phone not from my contact list is registered in the iMessage.
There is two general approaches that I've tryed.
- Send message to phone number if it's in buddy list
on run argv set toAddress to "+380631111111" set message to "Test" tell application "Messages" set targetService to 1st service whose service type = iMessage set targetBuddy to buddy toAddress of targetService delay 1 if targetBuddy exists then send message to targetBuddy end if #delay 5 end tell end run
Why it doesn't work? Even tho it can send messages by removing "delay 1" I don't want to spam users. With delay it can only check if phone in my buddy (contact) list.
- Trying to get button color by UI Automation. (Button goes red when phone is not registered in iMessage, and blue otherwise.)
tell application "System Events" to tell process "Messages"
set input to "TEST" as text
click button 1 of group 1 of splitter group 1 of window 1
delay 1
keystroke "+380931111111"
keystroke return
delay 1
set phoneInput to text field 1 of scroll area 2 of splitter group 1 of window 1
set phoneInputElement to menu button 1 of phoneInput
#set phoneInputElementColor to color of phoneInputElement
end tell
I'm unable to get button color because it doesn't have such property. Also I tried to get data from context menu where application says "+38093111111 is not registered in iMessage" but I can't reach context menu from AppleScript.
Please, help me to accomplish my mission :)