Zhelkus Posted April 4, 2008 Share Posted April 4, 2008 I just started using AutoIt with the idea that I could manage and perform better tasks than with RoboTask. I'm trying to create a loop for PNG images using FileFindFirstFile. However, that function isn't returning any values despite inputting everything correctly according to the help file. Every time it says that the folder is empty (@error=1) Here's the code: CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.10.0 Author: Zhelkus Script Function: Run PNGcrush on one or many images #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here $pngcrushchosenfolder = FileSelectFolder("Choose the folder where the images are stored. Subfolders will not be scanned.", "") If $pngcrushchosenfolder = "" Then MsgBox(0, "Task interrupted.", "Task will exit.") Exit EndIf $tempdir = EnvGet("temp") DirRemove($tempdir & "\pngcrush on autoit", 1) DirCreate($tempdir & "\pngcrush on autoit") FileChangeDir($pngcrushchosenfolder) $currentpng = FileFindFirstFile("*.png") ;MsgBox(0, "Current variable:", $pngcrushchosenfolder & "\") If $currentpng = 1 Then MsgBox(0, "Task finished.", "No files found, change search pattern.") Exit ElseIf $currentpng = -1 Then MsgBox(0, "Error", "Found an error") EndIf MsgBox(0, "Result", $currentpng) I'm also attaching the same task I made in RoboTask in case anybody has this program. Please help. Link to comment Share on other sites More sharing options...
flyingboz Posted April 4, 2008 Share Posted April 4, 2008 (edited) FileFindFirstFile. However, that function isn't returning any values despite inputting everything correctly according to the help file. Every time it says that the folder is empty (@error=1) use FileFindFirstFile() to include code. I don't see any code using FileFindFirstFile() ; so I can't help you learn how to use it. Review the Help example carefully. FFFF() gives you a HANDLE to a filelist you can browse with FFNF() , IT DOES NOT RETURN a filename Edited April 4, 2008 by flyingboz Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Zhelkus Posted April 4, 2008 Author Share Posted April 4, 2008 FFFF() gives you a HANDLE to a filelist you can browse with FFNF() , IT DOES NOT RETURN a filenameThanks. Just solved it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now