Yeah, basically I have a block that reports "File ( ) in folder [ ]" and if it gets a number higher than the amount of files in the folder, I get an error. I need to display all the files in the folder though, so to do this I need to do "repeat until <[File t1 in folder t2] = []>"
but I get an error, which I can't compare!
I either need a way to get the block to report something else like '' (nothing) when the file number does not exist, or a block called (number of files in folder [ ]).
any ideas? Here's the code:
|t3| t3_t1 asNumber. t1_t3. ^ ((FileDirectory on: t2 asString) entries at: t1) name asString.
and with my not-working script:
|t3 t4| t3_t1 asNumber. t1_t3. t4_ ((FileDirectory on: t2 asString) entries at: t1) name asString. t4 = 'error!' ifTrue: [^''] ifFalse: [^t4].
Offline
|t3| t3_t1 asNumber. t1_t3. [^ ((FileDirectory on: t2 asString) entries at: t1) name asString.] ifError: [^ '(nothing)']
Offline
Glad I could help
Offline
I'm working on a file browser, and since I want to do thumnails, is there a way I can make all image sizes be displayed as a same size thumb? e.g. a "sprite height" and "sprite width" reporter? Then I could set stretch effect to sprite width / width of square or something like that!
Offline
(Form fromFileNamed: t1) width
(Form fromFileNamed: t1) height
Offline