> How do I clear the MacPerl window before printing to it with >the print() function? There is no way to do this directly from MacPerl. However you can use AppleScript to select the contents of the window and then send another apple event to clear the window. The script below shows one way of doing it. One of the great drawbacks of AppleScript is the lack of any kind of flow control to indicate when the events have actually taken place. In this case a short delay is needed between sending the apple events and the next Perl print() statement, otherwise the second print() may (and almost certainly will) execute before the screen has cleared. Hence the rather gnomic line <select(undef, undef, undef, 0.1)>. You might also take a look at MPEdit.pm which allows 'printing' to an >editable< window in place of the normal (non-editable) MacPerl window. MPEdit can be found at <www.pacperl.com/depts/Codes/>. Alan Fry -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #!perl -w use Mac::AppleEvents; use strict; #Cave: Long lines may get broken by e-mail agents! $|=1; print "Hello\nhere is a line\nand another line.\n\nNow hit CR"; getc; clear_window(); print "Goodbye\n"; sub clear_window { my $win = "obj {want:type(cwin), from:'null'(), form:name, seld:'TEXT'(\@)}"; my $txt = "obj {want:type(ctxt), from:$win, form:indx, seld:abso(all )}"; my $sel = "obj {want:type(prop), from:'null'(), form:prop, seld:type(sele)}"; my $del = "obj {want:type(ctxt), from:$sel, form:indx, seld:abso(all )}"; my $evt = AEBuildAppleEvent( 'misc', 'slct', 'sign', 'McPL', 0, 0, "'----':$win", "MacPerl", ) or die $^E; AESend($evt, kAENoReply) or die $^E; $evt = AEBuildAppleEvent( 'misc', 'slct', 'sign', 'McPL', 0, 0, "'----':$txt", "MacPerl" ) or die $^E; AESend($evt, kAENoReply) or die $^E; $evt = AEBuildAppleEvent( 'core', 'delo', 'sign', 'McPL', 0, 0, "'----':$del", ) or die $^E; AESend($evt, kAENoReply) or die $^E; AEDisposeDesc $evt; select(undef, undef, undef, 0.1); } -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org