fbungarz wrote: ↑
11 Dec 18 0:33
Out of 38 image files, only 24 are imported, 14 skipped.
Did you check that numbers in the series didn't already exist on the hard drive?
I just checked the PSU code and the script code and I can't think of any reason why this wouldn't work. And as mentioned, it works flawless here. So something must be different. Already existing files in the target folder in the range could be an explanation.
Anyway, here's a version for your rename script that has locking hard coded in the script. I don't expect this to make any difference since PSU already does name rule parsing inside a lock of the import session...and so this is a wild shot. If this too doesn't work for you then I can only imagine that the files already exist in your target folder from a previous download. Or that somehow you're not using the download profile that you expect to be using.
Code: Select all
// - This script is designed to be used with the downloader pre-script
// "Download by Prefix", as it manages some of the registry keys used
// by this script.
// JAG, 16-Apr-2007
// HVZ, 23-Jun-2016 (converted to Photo Supreme)
// HVZ, 06-Dec-2018 (made script independent of the sequence as with multithreading, the sequence is not predictable)
// HVZ, 11-Dec-2018 (added critical section)
cScriptName = 'DownloadByPrefixList';
highestNumber, lastNumber: Integer;
ALock := TxomCriticalSection(StrToPtrInt(Nvl(PopFromStack(cScriptName), '0')));
if ALock = nil then
ALock := TxomCriticalSection.Create(cScriptName);
prefix := ReadFromRegistry ('dlByPrefixCurrent', 'prefix', '');
if (prefix = '') then prefix := 'UNKNOWN_';
highestNumber := ReadFromRegistry ('dlByPrefixCurrent', 'value', 0);
AStackName := cScriptName + prefix;
AFiles := TTntStringList(StrToPtrInt(Nvl(PopFromStack(AStackName), '0')));
if AFiles = nil then
AFiles := TTntStringList.Create;
if VarToStr(Nvl(PopFromStack(AStackName + 'session'), 0)) <> Session.GUID then
PushToStack(AStackName + 'session', Session.GUID);
idx := AFiles.IndexOf('%FileName');
if idx = -1 then
lastNumber := highestNumber + 1;
AFiles.AddObject('%FileName', lastNumber); // maintain the number used for this filename
// reuse the same number for existing files (e.g. TEST.JPG and TEST.NEF)
lastNumber := AFiles.Objects[idx];
if lastNumber > highestNumber then
WriteToRegistry ('dlByPrefixLastVals', prefix, lastNumber);
WriteToRegistry ('dlByPrefixCurrent', 'value', lastNumber);
// return our newly constructed filename
result := prefix + AddLeadingChars (IntToStr(lastNumber), '0', 4, False);
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing