From withing the stamp tool, use the above explanation to add a script for the handling of the dynamic functionality (Dynamic Text Stamp Settings button). Name it SelectValueFromCSV, and add this code to it.
var Lines = [];
function SelectValueFromCSV(params) {
var opt = params.split(',');
if (!Lines.length) {
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var objTextFile = objFSO.OpenTextFile(opt[0], 1 /*ForReading*/ , false, 0);
while (!objTextFile.AtEndOfStream) {
var strNextLine = objTextFile.Readline();
Lines.push(strNextLine.split(','));
}
objTextFile.Close();
}
return parseInt(Lines[CurrentTask.PageNumber][opt[1]], 10);
}
Now you can call it from any text, or barcode, stamp object, configured as Dynamic, like this:
[<SelectValueFromCSV>](c:\temp\test.csv,0) To fetch the serial number
[<SelectValueFromCSV>](c:\temp\test.csv,1) To fetch the QR code
[<SelectValueFromCSV>](c:\temp\test.csv,2) To fetch the registration code
In this example I'm explicitly typing the path to the csv file (change it to match yours), but you can replace it with the [C1] constant, if you want to have the previous example possibility to call it from a shell context menu item.
Or you may also configure a
My Tools stamp tool to have this stamp operation directly accessible from the Shell context menu.