Jump to content

File name with random strings.


Recommended Posts

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
    EndIf

Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')
Next

 

Edited by Wolfshare
Link to comment
Share on other sites

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

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") Then
If 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]

    EndIf

Run(@ProgramFilesDir & '\winrar\winrar.exe x "' & $sFileINeed & '" "C:\Users\Tomas\Downloads\Test\"')

Link to comment
Share on other sites

 

OK, last try
And 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

 

OK, last try
And 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...