At 12:48 pm +0900 01/04/01, Nobumi Iyanaga wrote:
>Anyway, Mac::Glue requires much memory (I have only 64 KB
>memory...), and a special configuration. I would still like to use
>Mac::AppleEvents to script Tex-Edit Plus. Is it something too
>difficult...??
you could do something like this perhaps:
#!perl -w
use strict;
use Mac::AppleEvents;
# activate Tex-Edit
my $evt = AEBuildAppleEvent ( 'misc', 'actv', 'sign', 'TBB6', 0, 0,
"" ) or die $^E;
my $rep = AESend($evt, kAEWaitReply) or die $^E;
# copy selected text from an open Tex-Edit file
$evt = AEBuildAppleEvent ( 'misc', 'copy', 'sign', 'TBB6', 0, 0,
"" ) or die $^E;
$rep = AESend($evt, kAEWaitReply) or die $^E;
# make a new Tex-Edit window named 'TEST WINDOW'
$evt = AEBuildAppleEvent ( 'core', 'crel', 'sign', 'TBB6', 0, 0,
"'kocl':type(cwin), prdt:{pnam:TEXT(\@)}",
"TEST WINDOW") or die $^E;
$rep = AESend($evt, kAEWaitReply) or die $^E;
# paste the clipboard to the new TEST WINDOW
$evt = AEBuildAppleEvent ( 'misc', 'past', 'sign', 'TBB6', 0, 0,
"" ) or die $^E;
$rep = AESend($evt, kAEWaitReply) or die $^E;
AEDisposeDesc $evt;
AEDisposeDesc $rep;
Is that the sort of thing you are looking for?
>>I would suggest using Mac::Glue instead of Mac::AppleEvents.
>>
>>This script creates a new window contained the selected text, with styles.
>>#######
>>#perl -w
>>use Mac::Glue;
>>use strict;
>>
>>my $glue = Mac::Glue->new('Tex_Edit_Plus');
>>$glue->activate();
>>$glue->copy();
>>$glue->make('new'=>'document');
>>$glue->paste();
>>#######
>>
>>Much nicer, I think...
>>
>>-Jeff Lowrey
I think so too...
Alan Fry