You are not logged in.
My digital (still) camera takes video clips, saved in .avi files. The camera also saves a .THM files with the same name, which provides metadata to the camera's software. I have seen such auxiliary files referred to as "buddy files". (was that here?)
If I rename the .avi file, then I would like the .thm file to be renamed with the same name, so they can continue to be used together.
This would be easy, until I rename the .avi with a name that includes AVI_width and AVI_height, which aren't defined for the .thm file. Does ReNamer have a way to handle renaming of buddy files, including situations where the new filename can't be directly constructed from the buddy file's own original name?
Offline
Yes, that can be done
You can add a PascalScript rule at the end of your preset, which will check the original FilePath variable, to see if it has a "buddy file". If it's there, rename the "buddy file" to the new name of the current file using the FileName variable and the WideRenameFile function.
Are you familiar with Delphi programming language? If not, I can write it for you...
Offline
I wrote alot of TurboPascal many years ago, but went on to other things before Delphi came out.
If you could point me to some example code referring to FileName, I could probably take it from there.
Offline
Below is the code to rename the buddy files with the THM extension. Tell me how it goes, ok?
NOTE: buddy files will be renamed on the Preview, since the rule will be applied on the Preview! So when you add this rule, make sure you unmark it while testing your rules set, and only when you are ready to rename, mark this last rule back on, and rename.
const
BUDDY_EXT = '.thm';
var
NewName, Buddy, NewBuddy: WideString;
begin
Buddy := WideChangeFileExt(FilePath, BUDDY_EXT);
if WideFileExists(Buddy) then
begin
NewName := WideExtractBaseName(FileName);
NewBuddy := WideExtractFilePath(FilePath) + NewName + BUDDY_EXT;
WideRenameFile(Buddy, NewBuddy);
end;
end.
Offline
Thanks, Denis. I'll try it tomorrow.
Offline
A function like 'IsPreview' could come in handy in these situations, eg: if not IsPreview then WideRenameFile(Buddy, NewBuddy);
'Preview proofing' all the calls that could actually do something would be a more user friendly way, but until we have 40 hour days there are usually better things to do <grin>
Offline
A function like 'IsPreview' could come in handy in these situations, eg: if not IsPreview then WideRenameFile(Buddy, NewBuddy);
Unfortunately, your suggestion is impossible to implement. This is because "Rename" action DOES NOT execute the rules, it simply renames files from current name to whatever specified in the New Name field. It is only for the "Preview" action the rules get executed, in order to generate new names.
P.S. "Preview" button should really be called "Generate"
Offline