Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Cannot Open files from array

$
0
0

Hi,

 

The files in the array cannot be opened. However, if I put the shellexecute outside the for loop, the first file will open when I exit the array.Thanks

AutoIt         
#include <File.au3> #include <Array.au3> Local $FileList = _FileListToArray("C:\Users\AJ\Desktop\AutoIT Examples", "*.pdf") If @error = 1 Then     MsgBox(0, "", "No Folders Found.")     Exit EndIf If @error = 4 Then     MsgBox(0, "", "No Files Found.")     Exit EndIf _ArrayDisplay($FileList, "$FileList") $arrLen = _ArrayLength($FileList, 2) For $i = 1 To $arrLen Step -1    MsgBox(0,"","Open" & $FileList[$i])    ShellExecute("C:\Users\AJ\Desktop\AutoIT Examples\" & $FileList[$i]) Next Func _ArrayLength($aArray, $iType = 1)     Local $iDim = UBound($aArray, 0)       If $iDim < 0 Or $iDim > 2 Then ; If not a 1D or 2D Array, then return -1 and set @error to non-zero.         Return SetError(1, 0, -1)     EndIf       Switch $iType         Case 2             If $iDim = 2 Then                 Return UBound($aArray, 2) * UBound($aArray, 1)             Else                 Return UBound($aArray, 1)             EndIf           Case 1             If $iDim = 2 Then                 Return UBound($aArray, 2)             Else                 Return 1             EndIf           Case Else             Return UBound($aArray, 1)     EndSwitch EndFunc   ;==>_ArrayLength

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>