I’m almost sure what I want is not accessible via a script. I will have ±100 PDF’s named like below but each name will be variable.
4900095 XXXXX YYYYY DDD_GGG AA CCCCCC to Widow or Spouse_excl. vol pensions PAID POLICY.pdf
The number in the beginning of the file name matches the data field SCHEME. I don’t want to rename the PDF to 4900095.pdf so that it works in my current script.
What would be ideal is if I could loop through ‘images/’ resource folder, get every image filename into an array, use said array with IF statement & Includes to match the SCHEME number in the beginning of the file name to the SCHEME field in the data mapper.
Answer is probably no, but it would be a great feature I think.
I know I can setup a Workflow process and rename said PDF’s but if this was possible… another step avoided is time saved
Guess I was oversimplifying things. You could try the Export Report function in the File menu. This can generate an XML export with all information of the template (including the images). Perhaps you can use this data to create your array (for example via a custom Data Map or XML to JSON converter). Admittedly a bit clunky but it may work.
function ShowFolderFileList(folderspec){
var fso, f, fc, s;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFolder(folderspec);
fc = new Enumerator(f.files);
s = "";
for (; !fc.atEnd(); fc.moveNext()) {
s += fc.item();
s += "<br>";
}
return s;
}
Once you have the list, you could search it for a match on the number at the beginning of the file.
Internal reference [SHARED-82303]. Provide access to the list of image resources from a user/control script (e.g. var images = merge.template.images; ).