4Bravo Posted November 2, 2012 Share Posted November 2, 2012 I apologize if this is fairly simple, I've spend more hours than I want to on it and can't seem to get Autoit to work on every file in a subdirectory. I've tried _FileListToArray and _FileListToArrayex but my complete lack of programming knowledge and copy and paste programming has only gotten me frustrated. I am able to run the following script on 1 directory and all file sin the directory: While 1 $file = FileFindNextFile($search) If @error Then ExitLoop ;c:\tmp in the following line can be edited to your choice of file location Run("C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\flash.exe $sAutoItDir\" & $file) $file = StringTrimRight($file, 4) WinWaitActive($file) ; send export command Send("^m") WinWaitActive("Export Movie") ; set new filepath and name Send("C:\tmp\" & $file & ".Mov") Send("{ENTER}") WinWaitActive("QuickTime Export Settings") ; dismiss export settings Send("{ENTER}") WinWaitActive("Adobe Flash CS5.5") ; dismiss export settings dialg Send("{ENTER}") ; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version WinWaitActive($file) ; close .fla file Send("^!x") ;Send("n") WEnd ; Close the search handle FileClose($search) But when I tried to run that on subdirectories I couldn't seem to search the array: #include <File.au3> #include <Array.au3> #include "FileListTOArrayEx.au3" $sAutoItDir = "D:\Animations\CYOA\Animation\Stock_Animations\Boy\Talking" $aArray = _FileListToArrayEx($sAutoItDir, "*.fla", 0 + 8 + 4) $search = FileFindFirstFile($aArray) While 1 $file = FileFindNextFile($search) If @error Then ExitLoop Run("C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\flash.exe $sAutoItDir\" & $file) $file = StringTrimRight($file, 4) WinWaitActive($file) ; send export command Send("^m") WinWaitActive("Export Movie") [b]; set filepath to open file's directory and name Send("C:\tmp\" & $file & ".Mov")[/b] Send("{ENTER}") WinWaitActive("QuickTime Export Settings") ; dismiss export settings dialg Send("{ENTER}") WinWaitActive("Adobe Flash CS5.5") ; dismiss export settings dialg Send("{ENTER}") ; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version WinWaitActive($file) ; close .fla file Send("^!x") ;Send("n") WEnd ; Close the search handle FileClose($search) I've also highlighted in bold my problem with using subdirectories, I'm not sure how to tell the mov to be rendered out the folder the file came from, in javascript I've used thelastIndexOf function to trim the directory, I see the StringTrimRight function removed the extension from the $file, but because every filename will have a different length I knew I couldn't use the same function to set a filepath Any help would be greatly appreciated Link to comment Share on other sites More sharing options...
saywell Posted November 2, 2012 Share Posted November 2, 2012 (edited) Look at Melba23's - it's great, and will do what you want.William Edited November 2, 2012 by saywell Link to comment Share on other sites More sharing options...
AZJIO Posted November 2, 2012 Share Posted November 2, 2012 My other projects or all Link to comment Share on other sites More sharing options...
4Bravo Posted November 2, 2012 Author Share Posted November 2, 2012 Thank you for replying, I have tried the with similar results. and after trying this _FO_FileSearch it seems to be the same. I get a list of files that is show in _ArrayDisplay. But where do I go from there? I've tried FileFindNextFile and the script doesn't want to do anything, it doesn't even return errors#include <Array.au3> #Include <FileOperations.au3> $sPath = "D:AnimationsCYOAAnimationStock_AnimationsBoyTalking" $FileList = _FO_FileSearch($sPath,'*fla') _ArrayDisplay($FileList) While 1 $file = FileFindNextFile($FileList) If @error Then ExitLoop ;c:tmp in the following line can be edited to your choice of file location Run("C:Program Files (x86)AdobeAdobe Flash CS5.5flash.exe $sPath" & $file) $file = StringTrimRight($file, 4) WinWaitActive($file) ; send export command Send("^m") WinWaitActive("Export Movie") ; set new filepath and name Send("C:tmp" & $file & ".Mov") Send("{ENTER}") WinWaitActive("QuickTime Export Settings") ; dismiss export settings dialg Send("{ENTER}") WinWaitActive("Adobe Flash CS5.5") ; dismiss export settings dialg Send("{ENTER}") ; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version WinWaitActive($file) ; close .fla file Send("^!x") ;Send("n") WEnd ; Close the search handle FileClose($FileList) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 2, 2012 Moderators Share Posted November 2, 2012 4Bravo,How about explaining in simple terms what it is you are trying to do? At the moment that code is so confused I am not at all sure. All I can tell you is that:$FileList = _FO_FileSearch($sPath,'*fla') _ArrayDisplay($FileList While 1 $file = FileFindNextFile($FileList) If @error Then ExitLoopis most certainly NOT looping through the array! M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
4Bravo Posted November 2, 2012 Author Share Posted November 2, 2012 I'm trying to perform a set of commands on every file in all subdirectories of a given path, one file a time. In the example above I'm using flash to export a quicktime, but I need it for a few other things as soon as I figure out how to attach the $file variable to any of the results I get from RecFilesListToArray or _FO_FileSearch Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 2, 2012 Moderators Share Posted November 2, 2012 4Bravo,OK, the following code should get you a list of all the files in the path folder and all subfolders - and then extract each one in turn for you to "do things with it:#include <Array.au3> #include <RecFileListToArray.au3> $sPath = "Your_Path" $sMask = "*.fla" ; We are only returning *.fla files ; The parameters are: Path, Mask, Files only, Recur) $aList = _RecFileListToArray($sPath, $sMask, 1, 1) ; Show what we got _ArrayDisplay($aList) ; Now loop through the array For $i = 1 To $aList[0] MsgBox(0, "File", "Number in array: " & $i & @CRLF & @CRLF & "Full file path: " & $sPath & "" & $aList[$i]) NextDoes that do what you want? M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
AZJIO Posted November 2, 2012 Share Posted November 2, 2012 (edited) expandcollapse popup#include <Array.au3> #include <FileOperations.au3> $sPath = "D:AnimationsCYOAAnimationStock_AnimationsBoyTalking" $FileList = _FO_FileSearch($sPath, '*fla') If @error Then Exit ; _ArrayDisplay($FileList) For $i = 1 To $FileList[0] ;c:tmp in the following line can be edited to your choice of file location Run("C:Program Files (x86)AdobeAdobe Flash CS5.5flash.exe " & $FileList[$i]) $FileList[$i] = StringTrimRight($FileList[$i], 4) WinWaitActive($FileList[$i]) ; send export command Send("^m") WinWaitActive("Export Movie") ; set new filepath and name Send("C:tmp" & $FileList[$i] & ".Mov") Send("{ENTER}") WinWaitActive("QuickTime Export Settings") ; dismiss export settings dialg Send("{ENTER}") WinWaitActive("Adobe Flash CS5.5") ; dismiss export settings dialg Send("{ENTER}") ; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version WinWaitActive($FileList[$i]) ; close .fla file Send("^!x") ;Send("n") WEnd Edited November 2, 2012 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
4Bravo Posted November 2, 2012 Author Share Posted November 2, 2012 Thank you, both of these are on the right track. Is there a way to trim $aList[$i] OR$FileList[$i] So it just has the file name in it and not the path from my dir to where it found the file? it's needed for the first WinWaitActive function $aList[$i]is opening the file just fine, but it is then waiting for /dir/dir/file.fla whenit should be looking for file, no extention Link to comment Share on other sites More sharing options...
4Bravo Posted November 3, 2012 Author Share Posted November 3, 2012 (edited) got this to work expandcollapse popup#include <Array.au3> #include <FileOperations.au3> #include <RecFileListToArray.au3> Opt("WinWaitDelay", 200) $sPath = "D:AnimationsCYOAAnimationStock_AnimationsBoyTalking" $FileList = _FO_FileSearch($sPath, '*fla', True, 125, 1 ) $justFILE = _RecFileListToArray($sPath, "*.fla", 1, 1, 1, 0) $flaDIR = _RecFileListToArray($sPath, "*.fla", 1, 1, 1, 2) For $i = 1 To $justFILE[0] $justFILE[$i] = StringTrimRight($justFILE[$i], 4) next For $i = 1 To $flaDIR[0] $flaDIR[$i] = StringReplace($flaDIR[$i], $justFILE[$i] & ".fla", "") next ; _ArrayDisplay($FileList) For $i = 1 To $FileList[0] Run("C:Program Files (x86)AdobeAdobe Flash CS5.5flash.exe " & $FileList[$i]) ;MsgBox(0, "", $justFILE[$i]) WinWaitActive($justFILE[$i]) ; send export command Send("^m") WinWaitActive("Export Movie") ; set new filepath and name Send($flaDIR[$i] & $justFILE[$i] & ".Mov") Send("{ENTER}") WinWaitActive("QuickTime Export Settings") ; dismiss export settings dialg Send("{ENTER}") WinWaitActive("Adobe Flash CS5.5") ; dismiss export settings dialg Send("{ENTER}") ; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version WinWaitActive($justFILE[$i]) ; close .fla file Send("^X") Next This exports an MOV file to the directory the file was opened from. I probably didn't need to use both array functions, but they work together in the end. Edited November 3, 2012 by 4Bravo Link to comment Share on other sites More sharing options...
AZJIO Posted November 3, 2012 Share Posted November 3, 2012 (edited) $justFILE = _RecFileListToArray($sPath, "*.fla", 1, 1, 1, 0) For $i = 1 To $justFILE[0] $justFILE[$i] = StringTrimRight($justFILE[$i], 4) Next _ArrayDisplay($justFILE)analogically, similarly$FileList = _FO_FileSearch($sPath, '*.fla', True, 125, 3) _ArrayDisplay($FileList) Edited November 3, 2012 by AZJIO My other projects or all 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