develooper Front page | perl.macperl.toolbox | Postings from June 2002

Re: [MacPerl-Toolbox] AppleEvents and GraphicConverter

From:
Alan Fry
Date:
June 5, 2002 10:09
Subject:
Re: [MacPerl-Toolbox] AppleEvents and GraphicConverter
Message ID:
p05100301b923de929e1c@[158.152.146.73]
At 3:57 pm +0200 05/06/02, Bart Lateur wrote:
>  >Many thanks -- it's a nice idea. There is a snag in that you can't
>>'get' the 'visible' of 'GraphicConverter' either until it has 'woken
>>up', or so it seems.
>>
>  >But you can keep 'setting' the visibility to false until there is no
>>AE error, which amounts to much the same thing and that works fine.
>
>Uh... does this work "nicely"? Shouldn't the perl script sleep() for a
>while before attempting again? Or does the AE stuff take care of the
>proper cooperation for multitasking? I would think of a microsleep of 1
>tick (60 per second IIRC), perhaps using Time::HiRes.

I had the same misgivings and in fact included a 100mS delay (with
four-element 'select') for no reason I could  put a finger on other
than it seemed a bit kinder to do so. (It also seemed prudent at the
same time to put a limit on the number of iterations to prevent the
script becoming stuck in an endless loop for some unforeseen reason.)

However, running it with and without the delay the script seems to
function similarly, but it's difficult to tell. If 'print' statements
are included you can see what is going on, but the 'print' does
introduce a delay. Otherwise you can't what's happening, other than
keeping an eye open for whiffs of smoke coming out from anywhereŠ

Mark you, there is a wide difference between one run and another.
Sometimes the 'set' takes on the second try; sometimes it takes five
or six seconds before success. Maybe it takes longer if one is
unlucky and catches the Finder at a moment when it is busy elsewhere?

At 8:12 am -0400 05/06/02, Chris Nandor wrote:
>	while ($finder->get( $visible ) || $^E) {
>
>:-)

:-)

Alan Fry



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About