rename files

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
dentopolis
Posts: 125
Joined: 06 May 2016, 16:28

rename files

Post by dentopolis » 28 Oct 2021, 13:34

I have a code working in AHK 1, that I'd like to work in AHK 2. I use it to rename files. How should I fix the code?

Code: Select all

R_CleanFileNames()
{
Loop Files, *.*
{ if (A_LoopFileExt != "ahk")
{ filename := SubStr(A_LoopFileName,1,-StrLen(A_LoopFileExt)-1)

filename := RegExReplace(filename,"[^a-zżźćńółęąśŻŹĆĄŚĘŁÓŃA-Z]+"," ") ; only accept alphabet
filename := trim(filename) ; remove leading and trailing spaces
StringLower filename, filename, T

FileMove % A_LoopFileName, % filename "." A_LoopFileExt , true
}
}
}
R_CleanFileNames()

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: rename files

Post by swagfag » 28 Oct 2021, 14:31

u can start by ctrl-fing through https://lexikos.github.io/v2/docs/v2-changes.htm, looking for the v2-equivalent functions, reading their doc pages and replacing them in-script until it finally compiles

or option B (which i hope u arent banking on) - wait for someone to do it for u

Post Reply

Return to “Ask for Help (v2)”