Arexx (61/67)

From:Thomas Hurst
Date:21 Oct 99 at 21:50:05
Subject:Re: Re: Filenumbering possible answer

From: "Thomas Hurst" <tom.hurst@clara.net>

Hi

On 20-Oct-99 23:59:14, Michael Jaccoud (topgun@pop.ch) wrote:

> /* Zufallsnamen (Sekunden) zu generieren */

> Zufall = SUBSTR(TIME(),7,2)

> DO UNTIL ~EXISTS('RAM:'Zufall''NAME'.JPG')
> Zufall = SUBSTR(TIME(),7,2)
> END
> SAVEBUFFERAS JPEG '"RAM:'Zufall''NAME'.JPG"' 85

Ewww, a busy loop... that will take a long time, as time() will only change
once a second.

What's wrong with something like:

/*
filespec = FindUniqueFile(basefilespec, fileextention)
e.g. myFile = FindUniqueFile('T:image','.jpg')
*/
FindUniqueFile: PROCEDURE
base = arg(1)
ext = arg(2)
do i=0 to 10000 /* Set to a higher number if needed */
if~exists(base||i||ext) then break
end
return(base||i||ext)
/*
*/

And then do:

SAVEBUFFERAS JPEG FindUniqueFile('Ram:',NAME'.JPG') 85

Regards

Tom



Editor, AmiSITE <----------> http://www.amisite.de/
Freaky on ARCNet <----------> http://arcnet.vapor.com/
RC5: 74,426 2^28 blocks <---> http://distributed.amiga.org/

I told you, I'm not allowed to argue unless you've paid!

--------------------------- ONElist Sponsor ----------------------------

??? Computer Questions ==> Free Answers From Live Experts ! ! !
go to EXPERTCITY.COM
<a href=" http://clickme.onelist.com/ad/expertcity15 ">Click Here</a>

------------------------------------------------------------------------
ARexx mailing list - No flames, no overquoting, no crossposting. Unsubscribe: Blank mail to mailto:arexx-unsubscribe@onelist.com