I have been using code in Xojo 2018 r3 to pull the newest two photos from the Pictures folder which has been running very fast. The idea is to grab a business card that was just scanned within the last 60 seconds.
I now upgraded to Xojo 2022 r1 and the same code spins and spins forever.
I ran this on a computer with just a few files in the Pictures folder and it works fine, but the production computer has about 1200 files in the Pictures folder.
Can you help figure out this method works great using Xojo 2018 but so slow in Xojo 2022?
The code I am using is as follows:
dim theFolder as FolderItem = SpecialFolder.Pictures
if theFolder<>nil then
if theFolder.Directory then
for i as Integer=1 to theFolder.Count
if theFolder.Item(i).Directory then //if a folder, skip it
//Next i
ElseIf ( Right(theFolder.Item(i).Name,4) = ".jpg" Or Right(theFolder.Item(i).Name,5) = ".jpeg" ) And _
( theFolder.Item(i).ModificationDate.TotalSeconds > d.TotalSeconds - 60 ) then
//add the jpeg files from the last 60 seconds
listbox1.addrow (theFolder.Item(i).Name, theFolder.Item(i).ModificationDate.SQLDateTime)
end if
next
end if
end if