Copy link to clipboard
Copied
Hi,
When I run the following script for the first time, I get an error (the file don't exist or you don't have the access or the file is use by another application) [InDesign CC 2014 v10.0].
If I run it again it works. Do you have an idea to fix this ?
var myFileArray= new Array;
var OutPutFile1 = new File("~/Documents/myfile1.txt");
var OutPutFile2 = new File("~/Documents/myfile2.txt");
// create and write files
OutPutFile1.encoding = "UCS-2";
OutPutFile1.lineFeed="Unix";
OutPutFile1.open( "w" );
OutPutFile1.writeln("foo1");
OutPutFile1.close();
//
OutPutFile2.encoding = "UCS-2";
OutPutFile2.lineFeed="Unix";
OutPutFile2.open( "w" );
OutPutFile2.writeln("foo2");
OutPutFile2.close(); ;
//push files in array
myFileArray.push(OutPutFile1);
myFileArray.push(OutPutFile2);
//load place gun
app.activeDocument.placeGuns.loadPlaceGun(myFileArray);


Have something to add?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more