I use an application named “EventScripts” that will monitor my bluetooth signal and trigger an applescript when the bluetooth signal is lost. I’ve written a short script that locks my computer when my iPhone is out of bluetooth range making the computer unusable. This part works flawlessly. It then triggers the following script:
tell application "Messages"
activate
set targetService to id of service "SMS"
set iMessageBuddy to buddy "1234567890" of service id targetService
send "iMac is Locked" to iMessageBuddy
tell application "Messages" to quit
end tell
The purpose of this is to send a message to my iPhone that the computer has been successfully locked. This part also works as long as the most recent message received is from “1234567890”. If, however, my most recent received message is from anything else, the script fails with the following error message:
Messages got an error: Can’t get buddy id "713C4D5F-C20B-4B93-B6F0-E9E4A208923B:1234567890".
Any idea or suggestions about how I can remedy this problem.