At 21:49 +0900 2001.11.13, Nobumi Iyanaga wrote:
>I posted this query some days ago, but it seems that there was no answer at
>all.  I would like to ask the same question again, assuming that probably
>nobody noticed my posting.

I saw it, but I don't use Nisus Writer.  I'll try to help as much as possible.


>>I have another question on AppleEvent:
>>I want to send a "do script" command to Nisus Writer.  Following the
>>example in
>>macperlcat.pod, and the examples you gave me another day, I think the
>>following snippet will work, EXCEPT the AppleEvent parameters
>>($ae{'params'}) [here, I simply copied the example given in
>>macperlcat.pod].
>>
>>use Mac::AppleEvents;
>>my (%ae, $event, $reply);
>>
>>my $macro;
>>$macro = 'Find/Replace "a" "b" "-g-SaA"';
>>
>>%ae = (
>>target =>'NISI',
>>class  =>'aevt',
>>id     =>'dosc',
>>params =>["'----':obj {want:type(cobj), " .
>>      "from:null(), form:enum(name), seld:TEXT(¥@)}",
>>      $macro]
>>);

I don't know what "¥" is supposed to be.  That should be a "\".  TEXT(@) is
similar to sprintf(), in that it replaces that macro with whatever string
you pass to it, properly formatted for an AE string.  So the "\" just tells
MacPerl to not treat the "@" as an array designator, but as a literal "@".
Maybe you did use "\" but it just got messed up in the character set
translation.


>>$event  = AEBuildAppleEvent(
>>      $ae{'class'}, $ae{'id'}, typeApplSignature,
>>      $ae{'target'},kAutoGenerateReturnID, kAnyTransactionID,
>>      @{$ae{'params'}}) || die($^E);
>>$reply  = AESend($event, kAEWaitReply) || die($^E);
>>AEDisposeDesc($event);
>>AEDisposeDesc($reply);

>>More generally, is there any way to know what we have to put in:
>>
>>want:type(xxxx)
>>from:xxxx
>>form:xxxx
>>seld:xxxx
>>
>>?
>>
>>I have Capture AE, which gives me:
>>
>>Process("Nisus? Writer").SendAE "NISI,dosc,'----':?Find/Replace "a" "b"
>>"-g-SaA"?, &subj:'null'()"
>>
>>So I think that "from" must be "null()"...

Well, from this, you do not need all of that junk with want/from/form/seld.
That stuff is only for when you need an object descriptor record.  Here,
Capture AE tells you that you just need to pass a string.  So I would use:

  %ae = (
    target => 'NISI',
    class  => 'NISI',  # not aevt
    id     => 'dosc',
    params => ["'----':TEXT(\@)", $macro]
  );

Normally "dosc" is in "misc" class, not "aevt", but Capture AE says "NISI".
And you just get rid of the object descriptor record stuff and use
'----':TEXT(@).

Hope that helps,

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to