Jump to content

Trying to make a auto-rename script


Venator
 Share

Recommended Posts

#include <File.au3>
#include <Array.au3>
$listOfFiles = _FileListToArray("C:\Users\Name\Desktop\Rename Project\Pics")
$csvToArray = FileReadToArray("QR_15367250133055137865.csv")

_ArrayDisplay($listOfFiles)

$num = 2
For $num = 0 To UBound($csvToArray) - 1
    $lastName = StringSplit($csvToArray[$num], ",")
    $lastNamers = StringLeft($lastName[1], 100)
    $lastNaming = StringReplace($lastNamers, """", "")

    $firstName = StringSplit($csvToArray[$num], ",")
    $firstNamers = StringLeft($firstName[2], 100)
    $firstNaming = StringReplace($firstNamers, """", "")

    $fullName = $lastNaming & " " & $firstNaming

    $iD = StringSplit($csvToArray[$num], ",")
    $iDS = StringLeft($iD[3], 100)
    $iDEAS = StringReplace($iDS, """", "")

    For $i = 0 To UBound($csvToArray) - 1
        If (StringInStr($listOfFiles, $fullName)) Then
            FileMove("C:\Users\Name\Desktop\Rename Project\Pics\" & $listOfFiles, "C:\Users\Name\Desktop\Rename Project\Finished Folder\" & $iDEAS & ".jpg")
        EndIf
    Next
Next

Can't figure out how to get the file name that I want to rename into the new name, for example "13a3E" --> "9231", and the old file name would be the file that contains the full name. 
I also have the "Array variable has incorrect number of subscripts or subscript dimension range exceeded" that causes this to not work. (_ArrayDisplay was for testing)

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...