aimy wrote:Stefan, as admin have pointed out, the only mistake in your script is on the rename line.
So, this is the corrected version of your script..
[...]
Now, there's no more error in the script.. It's just that...
Ahh, OK. Fine. Thanks Don for the help!
As you've mentioned before, this script will preview the renamed files one by one. Just imagine if I need to rename thousand of files and i need them to be previewed all at once. So now, how do I modify the script so that it can preview the renamed files normally just like with this simple rename command..

OK once more. Slowly...
The "p" char in that command
rename b, '<dateexif yyyymmdd.hhnnss>~*_' . $CamMod, p, $file;
is the option to enable that preview dialog.
What is "normally"?
Since we have to work on file by file to get the property for each single file
this rename command is invoked for each file,and so that preview is shown for each file too.
I don't know how to show an preview for all files from an script.
(Only with an workaround and collect all renaming strings and provide
them before real renaming with text() command or like that.)
To get rid of that preview for every file all you have to do is
to remove this p (leave the coma-delimiter) from that command,
as the commented line shows you:
Code: Select all
rename b, '<dateexif yyyymmdd.hhnnss>~*_' . $CamMod, p, $file;
//rename b, '<dateexif yyyymmdd.hhnnss>~*_' . $CamMod", , $file;
Just delete the line with the p
and remove the comment signs "//" from the remaining line.
Then you get no preview window anymore.
And BTW, an second pitfall in my script is the debug line to end the script after 1000 files.
You can just remove this whole line if you are sure the script works for your case:
Code: Select all
if ($index > 1000){break;} //prevent infinity loop while script testing
Here as an support is the whole script without those mentioned error handling lines:
Code: Select all
$list = get("SelectedItemsPathNames", "|");
$index=1;
while(true)
{
//get one after the other file from file list $file:
$file = gettoken($list, $index, "|");
if ($file==""){break;}
//read property from actual file:
$CamMod = property("CameraModel", $file);
//trim space and tabs around the reported property:
$CamMod = regexreplace($CamMod, "\s*|\t*(.*)\s*|\t*", "$1");
//rename only if that property is not empty :
if ($CamMod != "")
{
rename b, '<dateexif yyyymmdd.hhnnss>~*_' . $CamMod, , $file;
}
//process next file:
incr $index;
}
Hope this makes it somehow clearer
If anyone have more question(s)... just ask!