Using the sampleUI I'm at a loss as to how to get file renaming to work.
if you could push me in the right direction that would be great.
guiet
file renaming
file renaming
Check out the File object in the JS Tools guide. There is a 'rename' function (IIRC), but I usually do a copy/delete. It's not an xtools thing.
file renaming
Not sure I understand.
In the sampleUI there is a line of code
SampleUI.FILENAMING = true;
that brings up dialog boxes to rename the files in the UI.
there is also this line of code further on
var fname = name.replace(/(\.[^\.]+)$/, " - " + fileNameSuffix + "$1");
that renames the file.
I guess my question is what variables are associated with the FILENAMING text boxes and I'm only guessing but couldn't use those to build the fname variable?
or is there an example of how to incorporate the FileNamingDialog.jsx?
thanks for your patience
In the sampleUI there is a line of code
SampleUI.FILENAMING = true;
that brings up dialog boxes to rename the files in the UI.
there is also this line of code further on
var fname = name.replace(/(\.[^\.]+)$/, " - " + fileNameSuffix + "$1");
that renames the file.
I guess my question is what variables are associated with the FILENAMING text boxes and I'm only guessing but couldn't use those to build the fname variable?
or is there an example of how to incorporate the FileNamingDialog.jsx?
thanks for your patience
file renaming
Something like this should work.
Code: Select allvar fnOpts = pnl.filenaming.getFileNamingOptions(opts);
var fname = fnOpts.format(file);
If you want to see a large script that uses a lot of xtools functionality, check out CSX, also at the sourceforge website. I don't recall, however, if the FileNaming panel is used there. I have used it in scripts that I've written for clients, though.
Code: Select allvar fnOpts = pnl.filenaming.getFileNamingOptions(opts);
var fname = fnOpts.format(file);
If you want to see a large script that uses a lot of xtools functionality, check out CSX, also at the sourceforge website. I don't recall, however, if the FileNaming panel is used there. I have used it in scripts that I've written for clients, though.