Wolfshare Posted July 27, 2015 Author Share Posted July 27, 2015 (edited) Wolfshare, $aArray[0] is the array variable which contain the list of the files, so you have to put _FileListToArray before (like Mikell did in his last message) It's a headache for me.... "C:\Users\Tomas\Desktop\a.au3" (38) : ==> Subscript used on non-accessible variable.:For $i = 1 To $aArray[0]For $i = 1 To $aArray^ ERROR Take a look.. Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\", "*.exe.zip", 1, 1)Local $sFileINeed = ""For $i = 1 To $aArray[0] If StringInStr($aArray[$i], "Get Downloader") Then $sFileINeed = $aArray[$i] ExitLoop EndIfRun(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')Next Edited July 27, 2015 by Wolfshare Link to comment Share on other sites More sharing options...
iamtheky Posted July 27, 2015 Share Posted July 27, 2015 how about just *.zip in the filelisttoarray? and throwing a line below it that says: If @ERROR then msgbox(0, "" , "Im an error with the line above") ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Wolfshare Posted July 27, 2015 Author Share Posted July 27, 2015 how about just *.zip in the filelisttoarray? and throwing a line below it that says: If @ERROR then msgbox(0, "" , "Im an error with the line above")Variable used without being declared.:If StringInStr($aArray[$i], "Get Downloader") ThenIf StringInStr($aArray[^ ERROR The part of code. Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\", "*.zip", 1, 1)Local $sFileINeed = "" If StringInStr($aArray[$i], "Get Downloader") Then $sFileINeed = $aArray[$i] EndIfRun(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"') Link to comment Share on other sites More sharing options...
Wolfshare Posted July 28, 2015 Author Share Posted July 28, 2015 Any1 could help me handle this? Link to comment Share on other sites More sharing options...
mikell Posted July 28, 2015 Share Posted July 28, 2015 OK, last tryAnd don't remove some little "EndIf", "Next" etc they are necessary; list files in the folder, returning full path Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\", "*.zip", 1, 1) If @error Then MsgBox(0,"", "no zip file found in the folder") Else Local $sFileINeed = "" For $i = 1 To $aArray[0] ; loop through the array If StringInStr($aArray[$i], "Get Downloader") Then ; check file names $sFileINeed = $aArray[$i] ExitLoop ; exit the For loop if file found EndIf Next If $sFileINeed = "" Then ; "Get Downloader" not found in file name Msgbox(0,"", "no match with this file name") Else Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"') EndIf EndIf Link to comment Share on other sites More sharing options...
Wolfshare Posted July 28, 2015 Author Share Posted July 28, 2015 OK, last tryAnd don't remove some little "EndIf", "Next" etc they are necessary; list files in the folder, returning full path Local $aArray = _FileListToArray("C:\Users\Tomas\Downloads\", "*.zip", 1, 1) If @error Then MsgBox(0,"", "no zip file found in the folder") Else Local $sFileINeed = "" For $i = 1 To $aArray[0] ; loop through the array If StringInStr($aArray[$i], "Get Downloader") Then ; check file names $sFileINeed = $aArray[$i] ExitLoop ; exit the For loop if file found EndIf Next If $sFileINeed = "" Then ; "Get Downloader" not found in file name Msgbox(0,"", "no match with this file name") Else Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"') EndIf EndIf Finally!! Thank you. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 28, 2015 Moderators Share Posted July 28, 2015 Way to get the community to spoon feed it to you... "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
mikell Posted July 28, 2015 Share Posted July 28, 2015 I agree... but the thread was 25 messages long and it couldn't continue to grow Anyway getting a ready-to-use script is not a nice way to be helped, the OP will understand this sooner or later - hope so 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