eppc Messages from background user --- issues

All-

I have been searching and searching… I was able to do this before, but i can’t find my script that worked…

Let me tell you what i’m trying to do, and what i’ve tried, and what happened:

  1. I want my server to iMessage me when something happens, my server only runs 10.7 (can not run 10.8) and MessagesBeta expired and ruined my fun… So i currently have my server telling my 10.8 machine to send a message using Messages, but it comes from my normal iMessage account. I don’t want to change that account on that machine as i use Messages often to text friends/family/work… So i want to have a 2nd user running on my 10.8 machine and have my server tell that user on that 10.8 machine to send a message.

  2. Looking through all the forums here is the script i have tried:

using terms from application “Messages”
tell application “Messages” of machine “eppc://username:password@10.8Machine/?uid=504” --correct uid of user
to send “Test” to buddy “3135551234” of service “E:user@domain.com
end tell
end using terms from

it returns: "Messages got an error: Can’t get buddy “3135551234” of service “E:user@domain.com”. – I am omitting my email/phone for privacy but the account and phone number are valid and i can run that command from the user itself no problem.

I also tried:

using terms from application “Messages”
tell application “Messages” of machine “eppc://username:password@10.8Machine/Messages?uid=504”
to send “Test” to buddy “3135551234” of service “E:user@domain.com
end tell
end using terms from

This time i added the /Messages?uid=504" as i have seen in some posts, i get the error:

“Application Isn’t Running”

Anybody chime in and give me some guidance to what i’m doing wrong? I can control the logged in user no problem…

Updated:

I added &pid at the end of the eppc line, and it will freeze until i switch to that user… I can do it from 10.8 to 10.8 but it’s not liking 10.7 → 10.8… Any body?

using terms from application “iChat”
tell application “Messages” of machine “eppc://user:pass@10.0.1.x/?uid=502&pid=479”
send “test” to buddy “3125551234” of service “E:email@mydomain.com
end tell
end using terms from

i’ve tried using terms from application “Messages” but since Messages doesn’t work on 10.7 and the applescript dictionary is essentially the same, i tried both, neither works…

This should be such an easy task, send an IM from a background user from a remote computer…

Hi,

sending remote events is a bit tricky
For example you cannot launch an application directly.

Try this


property user_name : "user"
property pass_word : "pass"
property theUserID : 502
property hostName : "myHost.local"

set RemMachine to "eppc://" & user_name & ":" & pass_word & "@" & hostName & "/?uid=" & theUserID

try
	tell application "Finder" of machine RemMachine
		using terms from application "Finder"
			if "Messages" is not in (get name of processes) then
				open application file id "com.apple.iChat"
			end if
			repeat until "Messages" is in (get name of every process)
				delay 0.5
			end repeat
		end using terms from
	end tell
	
	using terms from application "Messages"
		tell application "Messages" of machine RemMachine
			send "test" to buddy "3125551234" of service "E:email@mydomain.com"
		end tell
	end using terms from
on error errorMessage
	display dialog "An error occurred: " & errorMessage
end try


The problem isn’t making sure the program is running… I run the program in the 2nd user, and get the UID and PID of Messages and the User and enter those into the scrpt on the remote machine then switch back to my primary user and it doesn’t work…

It runs… but times out…

Thoughts?