I’m trying to check if a file exists in a script so I can ensure there aren’t an image errors in my printer template.
I tried the following but the output doesn’t appear to be as expected. Whats wrong with this?
function imagecheck(tid) {
var file = host.type("System.IO.Directory");
var filename = "C:\\Barcode\\images\\" + tid + ".png";
var check = file.Exists(filename);
if (!file.Exists(filename)) {
dlg.ShowMessage("Image does not exist" + filename);
dlg.ShowMessage(check);
return '';
} else {
return ("<div style=\"text-align:center\";><img src="+ filename + ".png></div>");
}
}