Place Image Error
I've created a script that grabs a JPG, places it so I can get the dimensions, then creates a batch file for some other software to make it into a TIF packshot. I then place the TIF in place of the JPG (I know that this could be more streamlined). It also makes a couple of visits to some Photoshop droplets in the batch file too.
However,every so often - maybe every 30 images or so, it throws up a placing error when placing the TIF, stating "Error: Either the file does not exist, you do not have permission, or the file may be in use by another application." I put a loop in to wait a second then try again, and I still get the same error so it's not down to Photoshop not releasing the file quickly enough - I've also tried it on a 10 second delay. It occurs sporadically, and if I kill the script and place the file manually, it places fine. I've even tried putting in a break point in the catch function, cycling through the code manually, closing Photoshop completely (which is the last program to access the file), and it still won't place. My link is correct, there's nothing accessing the file, there is seemingly no problem with it at all. I've even tried modifying the file in Photoshop and it saves fine proving that it is not open elsewhere, but the file still won't place. It's almost like InDesign has made a decision that it doesn't like the file on this occasion. If I kill the script and re-run, it will place fine the next time around and another image will go wrong.
The code I'm using to place is:
for(counter = 0; counter < 10; counter++)
{
try
{
imageToPlace = new File(fileLocation+"//images//"+tempEAN+".tif");
gbImage[0].place(imageToPlace);
counter = 10;
}
catch(error)
{
$.writeln(imageToPlace.modified)
$.writeln(error);
$.sleep(1000);
}
}
}
If it's helpful, I'm running this on the company network, on a windows share from a windows 8.1 machine using InDesign CC 64 bit. It is definitely the place that is throwing the error as the "new File()" bit is working fine. I get the modified date of the file in the catch fine too.
Any help here would be very much appreciated.