Loading files.0001...

Dubbsta

Active member
Joined
Jul 13, 2017
Messages
197
I saw an example long ago don't know where and can't figure it out. I know I need a string of 0s. But how do I load images with numbers 001 and so on. Thx
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,100
There is not command to do this but you can easily achieve this with a FOR loop and inside build the string to represent the file name. Then store the image inside an array.
 

Jimmy

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
832
The example in examples/mojo/gerryq/picpuzzle.cxs shows how to load pic000 pic001 etc automatically, you can use that for saving as well.
 

dawlane

Well-known member
CX Code Contributor
Joined
Jun 21, 2017
Messages
827
A more compact version.
Code:
Strict

Function Main:Int()
    Local fileName:="myfile"
    For Local fileNo:=0 To 1000
        Print fileName+"0000"[.."0000".Length()-String(fileNo).Length()]+fileNo+".png"
    Next
    Return 0
End Function
 
Top Bottom