home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / next / programm / 6019 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.9 KB  |  55 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: 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
  3. From: prim!dave@germany.eu.net (Dave Griffiths)
  4. Subject: Re: performRemoteMethod does not work. What's wrong?
  5. Message-ID: <1992Sep7.023504.1197@prim>
  6. Keywords: performRemoteMethod speaker
  7. Organization: Primitive Software Ltd.
  8. References: <1992Sep6.120827.22094@itnsg1.cineca.it>
  9. Date: Mon, 7 Sep 1992 02:35:04 GMT
  10. Lines: 43
  11.  
  12. In article <1992Sep6.120827.22094@itnsg1.cineca.it> ronchet@itnsg1.cineca.it (Marco Ronchetti) writes:
  13. >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.
  14. >I'd like to do it from my program, without requiring the user to actually 
  15. >using WriteNow and giving the merge command.
  16. >
  17. >As a first step, I try opening a file with WriteNow (easy, it works). Then
  18. >I try passing a simple method with performRemoteMethod. I tried something
  19. >like "quit", "hide", "selectAll". (I verified that those methods do exist by
  20. >using NibEditor on WriteNow). Well, nothing happens, although I get a return
  21. >code = 0, which should mean that everything was fine...
  22. >
  23. >What do I do wrong? 
  24. >
  25.  
  26. A couple of things. First of all WriteNow's application object doesn't
  27. respond to "quit"; you should have used "terminate:". More importantly,
  28. WriteNow's listener does not respond to "terminate:" so it still wouldn't
  29. work. You can't send arbitrary messages to an apps listener - for it to
  30. work, the listener must be subclassed and methods added that expect the
  31. message you're sending. The standard Listener class does however respond
  32. to a limited set of remote messages, including "unhide" and "openFile:ok:"
  33. (the latter is used by your _speaker's_ sendOpenFileMsg method which is
  34. why that call worked OK).
  35.  
  36. Similar limitations apply to distributed objects in 3.0.
  37.  
  38. It's a real pity that you _can't_ send arbitrary messages to any object in
  39. an app. It would be simple to implement and be incredibly useful for the
  40. sort of things you're trying to do. Sort of like a built-in default API.
  41. And with Objective-C all the pieces are in place to do it. But NeXT, for
  42. reasons known only to themselves (lack of imagination?), don't seem to want
  43. to let us do stuff like this. (Imagine if you could: people would rave about
  44. how useful it was, how you could only do this sort of stuff on the NeXT with
  45. Obj-C etc etc. ).
  46.  
  47. Finally, a plug for a program I wrote called CyberMan which will let you
  48. write a script of events that you want passed to an application. What you
  49. want to do with WriteNow is exactly the sort of thing CyberMan was designed
  50. to handle. There is a copy on the archive sites, but beware: the only example
  51. script supplied doesn't work! (bug in the script, not in the program). A new
  52. much user-friendlier version should be out soon.
  53.  
  54. Dave Griffiths
  55.