🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by Marco Ronchetti Sun, 06 Sep 1992 12:08
performRemoteMethod does not work. What's wrong?
#781
Author: Marco Ronchetti
Date: Sun, 06 Sep 1992 12:08
33 lines
1636 bytes
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? 

Thanks
	Marco Ronchetti
	
===== here is my code:

- doIt:sender
{
	port_t thePort;
	int result, flag;	
	id targetApp;
	
	thePort = NXPortFromName("WriteNow",NULL);
	targetApp = [NXApp appSpeaker];
	[targetApp setSendPort:thePort];
	result = [targetApp sendOpenFileMsg:"/users/ronchet/Speaker/wd.wn"
	          ok:&flag andDeactivateSelf:NO];
	printf("open : %d %d\n", result, flag);
	result = [targetApp performRemoteMethod:"quit"];
	printf("quit : %d\n", result);
    return self;
}
Re: performRemoteMethod does not work. What's wrong?
#787
Author: Dave Griffiths
Date: Mon, 07 Sep 1992 02:35
43 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads