BBB Posted June 18, 2008 Share Posted June 18, 2008 Hello and sorry thank you for reading this. I am trying to accomplish the following: I have 5000 image files in sub-folders that are currently in TIF format. I am using ImageMagick to resize them to a specific resolution and convert them to JPG format. the command string for imagemagick is: convert -resize 2400 file.tif file.jpg I found this script that goes Recursive File Listing and logs that into a file. The script seems to be doing part of what I need, but for each filename instead of logging it into a file I need parsing it and executing the external "convert" program. Destination folder can be the same as where the original file resides. Can someone give me a hint or help me accomplish something like that? I have used Autoit, but only for automated website testing and only using certain internet explorer functionality that really does not apply here. Any of your help will be highly appreciated. Thank you. Script follows: ;Recursive File Lister Dim $FolderName = "C:\Documents and Settings\Administrator.DAGNET02\Desktop\ADAM-FINLI" Dim $FileCount = 0 ScanFolder($FolderName) MsgBox(0,"Done","Folder Scan Complete. Scanned " & $FileCount & " Files") Func ScanFolder($SourceFolder) Local $Search Local $File Local $FileAttributes Local $FullFilePath $Search = FileFindFirstFile($SourceFolder & "\*.*") While 1 If $Search = -1 Then ExitLoop EndIf $File = FileFindNextFile($Search) If @error Then ExitLoop $FullFilePath = $SourceFolder & "\" & $File $FileAttributes = FileGetAttrib($FullFilePath) If StringInStr($FileAttributes,"D") Then ScanFolder($FullFilePath) Else LogFile($FullFilePath) EndIf WEnd FileClose($Search) EndFunc Func LogFile($FileName) FileWriteLine(@ScriptDir & "\FileList.txt",$FileName) $FileCount += 1 ToolTip($FileName,0,0) EndFunc Link to comment Share on other sites More sharing options...
DjDeep00 Posted June 18, 2008 Share Posted June 18, 2008 @BBB.. This should be pretty straight forward... Just replace the "FileWriteLine(@ScriptDir & "\FileList.txt",$FileName)" line with the following command (See Helpfile): Run(@ComSpec & " /c " & 'convert -resize 2400 ' & $FileName, "", @SW_HIDE) This will work if you want all the images to resize to 2400. 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