Cycle that scrolls all the images of a folder

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Cycle that scrolls all the images of a folder

Post by AlessioForconi » Tue Nov 13, 2018 5:21 pm

Hello everyone,

I have a series of images (1.png, 2.png, 3.png etc etc) in a folder and I would like to run a loop that scrolls all the images themselves, I need to extract one based on specific conditions.

I do not know how to refer to the elements (the images in the folder).
I guess I have to put them in a matrix or similar, but I do not understand the way.

Thank you

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Cycle that scrolls all the images of a folder

Post by Klaus » Tue Nov 13, 2018 7:06 pm

Hi Alessio,

not ure what you mean, maybe:

Code: Select all

...
put "path/to_your/image_folder" into tFolder
put files(tFolder) into tFiles
## Now you have a CR delimited list of all files in that folder in -> tFiles
## Do whatever you need with this list...
## Is that what you were looking for?
...
Best

Klaus

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Cycle that scrolls all the images of a folder

Post by AlessioForconi » Tue Nov 13, 2018 7:26 pm

Yes, I was trying to do just that :D

But if I put

put defaultFolder & "/ days /" into tFolder
put files (tFolder) into tFiles
repeat for each item temp in tFiles
answer temp
end repeat

do I get a list of all files at the same time and it does not flow through every single file?
I have to select one based on the name.

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Cycle that scrolls all the images of a folder

Post by Klaus » Tue Nov 13, 2018 7:30 pm

Code: Select all

...
put defaultFolder & "/ days /" into tFolder
put files (tFolder) into tFiles
## repeat for each item temp in tFiles
repeat for each LINE temp in tFiles
       answer temp
end repeat
...
Is this what you were missing? -> LINE (not ITEM!)

AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Re: Cycle that scrolls all the images of a folder

Post by AlessioForconi » Tue Nov 13, 2018 7:32 pm

Exatcly! Thanks Klaus :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”