Strider <Strider@baka.com> writes Wed, 9 Sep 1998 15:12:43 -0400: >Is there or can there be a command, maybe implemented as system( 'clear' ) >(or MacPerl::Clear if you prefer), which clears a given window quickly? >It'd be a tremendous asset. If anyone else has any other way around this >problem, please let me know. It is possible to select all the text in a window using AppleScript and then delete the selection with the back-space, chr(8). Effectively, that clears the window. #!perl use Mac::AppleEvents; $|=1; print "a line\nand another line\nand then wait for a CR"; getc; select_text(); select(undef, undef, undef, 0.01); # a short delay print chr(8); sub select_text { $obj1 = "obj {want:type(cwin), from:'null'(), form:name, seld:TEXT(\@)}"; $obj2 = "obj {want:type(ctxt), from:$obj1, form:indx, seld:abso(all )}"; $evt = AEBuildAppleEvent( 'misc', 'slct', 'sign', 'McPL', 0, 0, "'----':$obj2", "MacPerl" ) or die $^E; AESend($evt, kAENoReply) or die $^E; AEDisposeDesc $evt; } It seems a small delay is necessary between sending the 'slct' event and calling 'print chr(8)'; otherwise the 'print' happens before the text has actually been 'selected'. Is there any way of testing to see if an Apple Event has finished before going on? Does anyone have any ideas? It is easy to see the event has been sent, but if there is no reply (as in this case) how do you find out when all's done? Alan Fry ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch