On day8/3/01 at 7:57 pm -0500, Morbus Iff wrote:

>  >There's always Apple Events of course...


>That's a pretty good solution, actually. Of course, I know crap about
>AppleScript which is even better <g>... When I close this window, it asks
>if I want to save "Test" - is there anyway I can remove this dialog?

Yes; work with a temporary file and save it by AE when you want.

#!perl
$temp = $ENV{TMPDIR};
mkdir $temp, 0;
$tempfile = $temp.'temp.txt';
open TEMPFILE, ">$tempfile";
foreach ('a'..'m'){writewindow()}
$_ = $/; writewindow();
savewindow();

sub writewindow{
MacPerl::DoAppleScript(<<END_SCRIPT);
if not (exists window "temp.txt") then
   open file "$tempfile"
   set bounds of window "temp.txt" to {800, 30, 950, 400}
end if
tell window "temp.txt" to set contents of selection to "$_"
END_SCRIPT
}

sub savewindow{
MacPerl::DoAppleScript('save window "temp.txt"');
}

>And can I specify various other window types through Applescript?

No.

Whatever you're aiming to do, you'd probably get the best results by 
working from the outside in, sending the do script event to MacPerl 
and logging your results in whatever program or utility (eg. 
OneClick) you're working from.  The do script event is instantaneous 
and no time is wasted compiling, as it is when you do things the 
other way round.  For example, in Script Editor you could do:


set perlscript to "print 'hello'"
tell app "MacPerl"
   set x to Do Script perlscript mode Batch
   log x
end tell

JD

Reply via email to