Notifiations via iMessage

Hello,

recently I bought access to a VPN-Server. My idea was to make a AppleScript that notifies me every time the VPN gets disconnected. In addition to that BitTorrent should stop all downloads when I get disconnected.


property serviceName : "E:somename@iCloud.com"

set Bud to "+aphonenumber"

set msg to "VPN disconnected"


tell application "Messages"
	activate
	set iMessageService to service serviceName
	set theBuddy to buddy Bud of iMessageService
	
	send msg to theBuddy
	
	quit
end tell

Thats my progress so far. Everything works fine but sometimes I get the texts way too late or iMessage isn’t even able to send them. What could I change that it works reliable? Is there a way to only quit iMessages when the text has been sent and if it failed to do so to try it again until it succeeded? And how do I tell BitTorrent via AppleScript to stop it’s downloads? (As you might can tell, I’m not the most experienced AppleScripter :rolleyes: )

Thanks in advance!

Hi Shellficious,

I don’t know anything about Messages. but does the computer sleep?

gl,

@kel1

No, it doesn’t…

Does the hard disk spin down?

Nope, SSD installed.