Sending appleevents to another mac on a net

Hi all. I’m interested in sending events to the quicktime player on another mac on my airport network.

How might one go about identifying that the target computer exists and then sending the message to it?

I apologize for my lameness in advance.

You need to get the IP of the target and then do :


tell application "Quicktime Player" of machine "eppc://theIpOfTheRemoteMachine" to doSomething

I tried that last night and all I get is either the AEVT server running at 85% or “can’t open application dictionary”

What format must the machine string be in? I have tried
“eppc://user:password@TCP/IP address”
“eppc://tcp/ip address”
“eppc://rendezvous address”
“eppc://shortname”

and so on and so on. Even tried to send a message to the machine I was currently on to display a dialog or quit the quicktime player.

Also, is there a way to launch an app on another machine ala applescript?

If I’m not mistaken, the remote target app must be running to receive commands. Since the Finder is generally running, you can use it to open the application. Something like this should be close to what you need:

using terms from application "Finder"
	tell application "Finder" of machine "eppc://user:password@192.168.0.199/"
		open file "path:to:QuickTime Player"
	end tell
end using terms from

using terms from application "QuickTime Player"
	tell application "QuickTime Player" of machine "eppc://user:password@192.168.0.199/"
		-- do stuff
	end tell
end using terms from

– Rob

Thanks Rob but the app in the target IS running, accept remote events is on I’m still getting this “can’t open application’s event dictionary” message. Even with your code. I’m in 10.2.6 on a 1G ti

Tried talking to my g3 400, g3 500 and back to the 1G Ti. No dice.

I’m not sure what the problem might be. The code that I offered works for me when sent from OS X 10.2.6 to OS 9 and that’s the extent of my experience (OS X to OS 9). :?

– Rob

Well, I’ve tried all computers as target and host so I’m thinking it might be something in my setup.

ANY ideas?

Rob, can you send Appleevents to your source OS X box by putting in its own IP address?

There might be a problem with OS X receiving remote appleevents.

To date, I’ve been trying to send from one OS X box to another.

Is it possible that you have a firewall/router that’s interfering? Are you able to mount volumes on the other machines?

– Rob

I tried this at home and in the office. I can log in to the other machines over appletalk & Tcp/ip. My personal firewall in Sharing is off on both computers.

I tried
sending from the g3 400 to the 1G Ti
sending from the g3 400 to itself
sending from the 1G Ti to the g3 400
sending from the 1G Ti to itself
sending from the 1G Ti to the g3 500
sending from the g3 500 to the 1G Ti
sending from the g3 500 to itself

All OS X

I’m going to set up a computer to computer airport net and see it that might change anything.

Pain in the ass huh?

Is this documented anywhere?

If it isn’t in the Help system, you might find something by searching Apple’s web site.

– Rob

Apple’s docs are out of date and incomplete. The most recent I could find is from 1999.

Nothing in Applescript in A Nutshell either.

Thanks. I’m going to tell applescript to piss off and use some other technology.

What a waste of time.

I went about nuts trying the same thing, getting the same message, but then stuck a “using terms” structure around the script,

using terms from
application “app”
tell application “app” of machine “eppc://user:pass@192.168.0.2”
(commands)
end tell
end using terms from

and it worked. I had to reboot the target machine at one point, though, because AEServer had gone Zombie on me.

Apple wants to push AppleScript as the great tool that it is, but their support and documentation are an embarrassment.

AppleScripting in such a vacuum can be frustrating, but so dang cool when it does work!

I’m going to freak my family out upstairs by having the iMac on the desk start playing music on its own.

I just started looking into this today and found this listing very helpful. Here are some things I found while testing that may be contributing to the difficulties of sending remote events.

First of all the OS 9 machine’s file sharing must be set up properly or you may get any of the folowing errors:
“can’t open application dictionary”
“Finder got an error: could not establish connections to host”
“got session reject”

  1. File sharing and program linking must be on with the check boxes for use over TCP/IP selected for both.
  2. OSX wants to find a username and a password. Although you can set your OS 9 machines not to have passwords once you have a property set in your script, to actually get the connection from X to 9 you will need both, or at least that is what I have found.
  3. Inside the users&groups tab of the file sharing control panel you must open the owner, show the sharing info from the drop menu in the pop up window, and then check the “Allow user to link to programs on this computer” check box at the bottom.

After you have done this the using terms from bracket works like a charm, just as it does for OSX to OSX senarios.

Anyone want to tell me what’s going on with this one? :rolleyes:

I haven’t had any luck whatsoever trying to send commands from my OS X machine to my PM 7600 running OS 9.1, so I figured I’d try the other way around. So I proceeded to try the following in Script Editor (in OS 9 on that machine):

tell application “Finder” of machine “eppc:mdouma46@#######@192.168.1.1
activate
end tell

Hit the Compile button and got the following error message.

frustrating…

Is that error message a joke? It’s gotta be. The question is, yours or Apple’s?

Sorry I can’t offer any help.

your tell statement is flubbed.

Try:


tell application "Finder" of machine "eppc://username:password@192.168.1.1"
activate
end tell

I sometimes see these Apple Events over IP things come up from time to time. I don’t know why some people have so many problems with it. I am not blaming the people trying to use it, because it seems like they are doing things correctly. I don’t understand what could be causing the frustration. I have had very good luck with applescripting over a network. In fact, I have a single machine that is controlling the activities of 9 others (soon to be 10 Dual Xserve G5s!!! Whoohoooo!!!) I will clarify that I have only had a really good experience with it after moving to OSX (currently 10.3.3)

The only real pointers that I can share is…
1.) Verify that “Allow Remote Apple Events” is turned on in Sharing (OSX) for all machines.
2.) Verify that “Remote Apple Events(3031)” is unchecked if your filewall is on
3.) Turn on Program Linking (OS9)
4.) Verify that your machine address is in the proper format
5.) Probably want the target app to be running

I am currently not using the “Using terms from”. I don’t fully understand its use, but I think it is a way to compile your script using the dictionary from a local copy of the app, especially if that remote app isn’t available.

I also use static IPs for all of my machines, so I don’t really know how using DHCP affects it.

Here is a link to my (rarely updated) blog. On it I have some examples of scripts that talk to each other over a network. Maybe it will help. Don’t give up on it, though. It really is pretty cool when you get all of these machines communicating with each other!

http://homepage.mac.com/bhays/iblog/index.html

Mark,

Try using this format: “eppc://user:password@192.168.0.199/”

You might also need to wrap the commands in a ‘using terms from’. Check out my code earlier in the thread.

– Rob