Re: COM on mac
Re: COM on mac
- Subject: Re: COM on mac
- From: matt neuburg <email@hidden>
- Date: Tue, 14 Jan 2003 17:19:56 -0800
On 1/14/03 at roughly 2:31 PM, thus spake Andy Satori <email@hidden>:
>
What I don't get is a real world example of the 'I want to
>
create an instance of an application or framework for use
>
in my application on a remote machine and call it's
>
methods'.
>
>
Now, I've used AppleScript to do a limited amount of this
>
on the local machine, using Mail, iCal, AddressBook, and
>
Entourage to accomplish some of these tasks via
>
AppleScript isn't very difficult.
>
That's dandy, but how do I know take that concept
>
and apply it to the Objective C environment and distribute
>
it across a pair of machines?
Well, I'll give two sorts of answer. First of all, you should probably read up on Distributed Objects, a really cool technology that allows two Cocoa apps to talk to each other. But this only works if you wrote both apps (in effect).
Second, let's talk about the remote variant of what you already have figured out how to do. You've probably discovered that you can say this on your machine:
tell application "Finder" to get name of disk 1
Okay, now let's do that from machine to another. We'll hook the two machines up across a network; in this case let's have this be a local network. On the "remote" machine we go into the Sharing pref panel and turn on Remote Apple Events (this used to be called "Program Linking" before you came on board, but never mind that now). Back on the "local" machine, I will speak to the Finder on the remote machine. For this example I'll use its rendezvous name, and my username and password, like so:
tell application "Finder" of machine "eppc://myUsername:email@hidden" to get name of disk 1
I could have used the IP number instead, though, and done this across the Internet. You can learn more by reading about interapplication communications but sometimes one AppleScript example is worth 1000 Apple event words (and of course you could just run an AppleScript from inside a Cocoa app). m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.