AmigaActive (846/1286)

From:Neil Bothwick
Date:20 Aug 2001 at 21:35:29
Subject:Re: ARexx and MUI?

Robert Cranley said,

> Hi All,
> Just wrote a simple script for controlling SongPlayer, and it launches
> SongPlayer if it isn't already running, then waits for the port etc. before
> continuing. Problem is if I run the script first thing after I boot, it
> takes *ages* (as in >30 sec.) to open the SongPlayer window, but it opens
> straight away if I quit and restart it, or if I have run any MUI apps before
> running the script.

It will take longer to start up if the MUI libraries and clases need to
be loaded.

> ADDRESS "COMMAND"

> IF ~SHOW(ports, "SONGPLAYER.1") THEN DO
> "WBRun Work:Sound/SongPlayer/SongPlayer"
> END

> DO UNTIL SHOW(ports, "SONGPLAYER.1")
> END

Ugh! That's busy-looping until SongPlayer is loaded. ARexx is sucking up
gobs of CPU time, causing the MUI load to take much longer.

Try

options results
address command
if ~show('P', 'SONGPLAYER.1') then do
'WBRun Work:Sound/SongPlayer/SongPlayer'
for i = 1 to 6 until RC = 0
'waitforport SONGPLAYER.1'
end
if RC > 0 then exit

rest of script.

Waitforport waits up to ten seconds for the port to appear, and returns
WARN if it hasn't. This loop exits as soon as SongPlayer's port
appears, or after a minute with an error if it doesn't load by then. CPU
usage is about 0.000000005% of your version :)

Cheers

Neil



Neil Bothwick - New Media Editor, Amiga Active Magazine

"I do not fear computers, I fear the lack of them" - Asimov

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Do you need to encrypt all your online transactions? Secure corporate intranets? Authenticate your Web sites? Whatever
security your site needs, you'll find the perfect solution here!
http://us.click.yahoo.com/Bre3tC/Q56CAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->

Quote carefully and read all ADMIN:README mails
To unsubscribe mailto:amigactive-unsubscribe@yahoogroups.com
Anyone sending unsubscribe messages to the list will be SHOT!

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/