Checking whether external image file exists
Posted: Wed Jul 18, 2018 11:47 am
Hello LC developers:
I have having trouble writing the code that checks whether an image file exists in a folder. Using Windows 10 and LC 8.1.1. Let's say the image is "cat.png" and the image object on my card is image "animal." The following code for checking the existence of a folder works great:
but substituting "file" for "folder" does not work:
Is it my code or a glitch in my system? Experimented with substituting "binfile" for "file" without success. Online dictionary entry for "there is a" didn't help. If referencing images doesn't work, I guess I will have to import them. Thank you for your response(s).
Monty
I have having trouble writing the code that checks whether an image file exists in a folder. Using Windows 10 and LC 8.1.1. Let's say the image is "cat.png" and the image object on my card is image "animal." The following code for checking the existence of a folder works great:
Code: Select all
put "cat" into tImage
put "c:/Users/myName/Documents/Images/" into tFolder
if there is a folder tFolder then
set the filename of img "animal" to tFolder&tImage&".png"
end if
Code: Select all
put "cat" into tImage
put "c:/Users/myName/Documents/Images/" into tFolder
if there is a file tFolder&tImage&".png" then
set the filename of img "animal" to tFolder&tImage&".png"
end if
Monty