Article View: comp.sys.next.programmer
Article #787Re: performRemoteMethod does not work. What's wrong?
From: Dave Griffiths
Date: Mon, 07 Sep 1992 02:35
Date: Mon, 07 Sep 1992 02:35
43 lines
2990 bytes
2990 bytes
In article <1992Sep6.120827.22094@itnsg1.cineca.it> ronchet@itnsg1.cineca.it (Marco Ronchetti) writes: >I'm trying to pass commands to WriteNow. The ultimate goal is to build a file of addresses and infos with a Database, and then merge the info in a wn document. >I'd like to do it from my program, without requiring the user to actually >using WriteNow and giving the merge command. > >As a first step, I try opening a file with WriteNow (easy, it works). Then >I try passing a simple method with performRemoteMethod. I tried something >like "quit", "hide", "selectAll". (I verified that those methods do exist by >using NibEditor on WriteNow). Well, nothing happens, although I get a return >code = 0, which should mean that everything was fine... > >What do I do wrong? > A couple of things. First of all WriteNow's application object doesn't respond to "quit"; you should have used "terminate:". More importantly, WriteNow's listener does not respond to "terminate:" so it still wouldn't work. You can't send arbitrary messages to an apps listener - for it to work, the listener must be subclassed and methods added that expect the message you're sending. The standard Listener class does however respond to a limited set of remote messages, including "unhide" and "openFile:ok:" (the latter is used by your _speaker's_ sendOpenFileMsg method which is why that call worked OK). Similar limitations apply to distributed objects in 3.0. It's a real pity that you _can't_ send arbitrary messages to any object in an app. It would be simple to implement and be incredibly useful for the sort of things you're trying to do. Sort of like a built-in default API. And with Objective-C all the pieces are in place to do it. But NeXT, for reasons known only to themselves (lack of imagination?), don't seem to want to let us do stuff like this. (Imagine if you could: people would rave about how useful it was, how you could only do this sort of stuff on the NeXT with Obj-C etc etc. ). Finally, a plug for a program I wrote called CyberMan which will let you write a script of events that you want passed to an application. What you want to do with WriteNow is exactly the sort of thing CyberMan was designed to handle. There is a copy on the archive sites, but beware: the only example script supplied doesn't work! (bug in the script, not in the program). A new much user-friendlier version should be out soon. Dave Griffiths
Technical Details
Message-ID:
<1992Sep7.023504.1197@prim>Path:
arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!prim!daveReferences:
<1992Sep6.120827.22094@itnsg1.cineca.it>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!prim!dave From: prim!dave@germany.eu.net (Dave Griffiths) Subject: Re: performRemoteMethod does not work. What's wrong? Message-ID: <1992Sep7.023504.1197@prim> Keywords: performRemoteMethod speaker Organization: Primitive Software Ltd. References: <1992Sep6.120827.22094@itnsg1.cineca.it> Date: Mon, 7 Sep 1992 02:35:04 GMT Lines: 43