Main Area and Open Discussion > Living Room
Renaming query: how to keep e.g. 1a, 1b when renumbering
tomos:
Hi Lintalist
many thanks --
first, I dont know will this work in the sense I want it to follow a particular sort in the file manager (I'm afraid I didnt emphasise that aspect initially)
I saved above as AHK file, added correct paths:
--- Code: Autohotkey ---source:=A_ScriptDir "G:\User\xxxx\Family\Scans\Final_Sorting\xyz\"target:=A_ScriptDir "G:\User\xxxx\Family\Scans\Final_Sorting\"
and ran the script, and nothing happens.
I notice:
when I copy from your code from your post, there is a tab-width before each line --
wondering could this be causing it to fail ?
Lintalist:
This should do it
--- Code: Autohotkey ---source:="G:\User\xxxx\Family\Scans\Final_Sorting\xyz\"target:="G:\User\xxxx\Family\Scans\Final_Sorting\"A_ScriptDir is also a path, so the way you had it it would be C:\temp\G:\User\ or something like that (where c:\temp\ was the script folder). Tabs/space have no influence in the scripts. (unless something goes wrong when copying the code from the forum but I doubt it). BUT...
You can do it differently, in your filemanager sort them the way you want, I trust your filemanager has a way to copy the list of (selected) files to a file or clipboard (TC has, so Dopus must have it too). Save it to a file, say "source.txt"
--- Code: Autohotkey ---sourcefiles:="" ; don't edit this, you can omit this or leave it empty. ; source.txt is a list of files saved in the order you want them to be processed, sorted in your filemanager; replace "source.txt" below with "full path to source.txt" sans quotesFileRead, sourcefiles, source.txt source:="G:\User\xxxx\Family\Scans\Final_Sorting\xyz\"target:="G:\User\xxxx\Family\Scans\Final_Sorting\" sourcefiles:=trim(sourcefiles,"`n") ; remove ; before msgbox below to confirm it has the proper filenames; MsgBox % sourcefiles Loop, parse, sourcefiles, `n, `r { If RegExMatch(A_LoopField,"i)a|b\.jpg") ; if we have a|b.jpg skip it continue SplitPath, A_LoopField, OutFileName, , , OutNameNoExt counter:=SubStr("000" A_Index, -3) ; remove ; before msgbox below to "see" what it tries to find ; MsgBox SourceFile: %source%%OutFileName%`nTargetFile: %target%%counter%.jpg FileCopy, %source%%OutFileName%, %target%%counter%.jpg IfExist, %source%%OutNameNoExt%a.jpg FileCopy, %source%%OutNameNoExt%a.jpg, %target%%counter%a.jpg IfExist, %source%%OutNameNoExt%b.jpg FileCopy, %source%%OutNameNoExt%b.jpg, %target%%counter%b.jpg }
Fingers crossed :-)
Edit: Source.txt must be in the same folder as the script, if it is not adjust it to full path:
FileRead, sourcefiles, G:\User\xxxx\Family\Scans\Final_Sorting\xyz\source.txt
Edit2: source.txt is just a list of filenames, no path, added source:="" line back in the script
tomos:
I added source folderpath to it as well as the target filepath -- or should I simply run the ahk file from the source folder?
EDIT// I also tried just adding path of source.txt to source - no joy there either //EDIT
I added a source.txt file to the source folder, with a list of files as sorted e.g.
0869.jpg
0871a.jpg
0880.jpg
0886.jpg
0889.jpg
0902.jpg
When I run the ahk script, nothing happens (I know it does get 'read', as I mistakenly didnt copy the last bracket and got an error message about that -- no more feedback once that was corrected)
Lintalist:
I'd deleted the source:= line I see, added it in the script above, the source.txt should like you have posted it as above e.g. just filenames, no paths.
Fingers crossed 2 :-)
tomos:
Still not working:
I've added:
--- Code: Autohotkey ---sourcefiles:="Full-path of source.txt" ; source.txt is a list of files saved in the order you want them to be processed, sorted in your filemanagerFileRead, sourcefiles, source.txt source:="source folder path\"target:="target folder path\"
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version