[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] clear?



At 11.23 +0000 2000.01.11, John Delacour wrote:
>At 10:13 pm -0500 10/1/00, Chris Nandor wrote:
>>At 21.46 -0500 2000.01.10, Werewolf21@aol.com wrote:
>>>Hey, I've got an easy, short question, I'm looking for a clear command so I
>>>can clear the text from a screen, I know that most programming types have
>>>one, only I can't seem to find this one.   Thanks
>>
>>There isn't one for MacPerl.  A kludge is something like:
>>
>>   MacPerl::DoAppleScript('close window "MacPerl" of app "MacPerl"');
>
>Far better to send events from OneClick <http://www.westcodesoft.com>
>or from Osa Menu <ftp://www.lazerware.com>.

Not if you are already using MacPerl.  You may like controlling MacPerl
from AppleScript, but I think most people will find it is a kludgier way to
work.  And the speed difference is not an issue for most Macs these days.

Although, you can also do this, to speed things up:

  #!perl -w
  # script one
  use Mac::OSA::Simple;
  my $script = compile_applescript('close window "MacPerl" of app "MacPerl"');
  $script->save('some:file');


  #!perl -wl
  # script two
  use Mac::OSA::Simple;
  my $script = load_osa_script('some:file', 1);

  print 1;
  $script->execute;
  print 2;


The first script you run once (or just save a compiled script from Script
Editor, it is the same thing) and then you can load the script and run it
later.  Compilation time is eliminated and it runs just as fast as it does
from any other program (modulo the time it takes to load in
Mac::OSA::Simple).


>        -- Compiled script "Clear MacPerl \B" -- use Command-B to activate
>        tell app "MacPerl"
>          Close Window "MacPerl"
>          set Visible of Window "MacPerl" to true
>        end tell
>       
>
>This is extremely fast (as the window closes it is there again
>without an perceptible invisible phase) and has the great advantage
>that it leaves "MacPerl" in the background, so it is not necessary to
>switch back to the composition window.

If MacPerl is already in front, then this is not a problem.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org