Copy link to clipboard
Copied
How can I make a simple script that places a spesific InDesign snippet in the document, at cursor point?
Just like when draging a snippet in to a document.
Im on a Mac
@David André – populate the placeGun with a file (one IDMS file) or with an array of files (more than one IDMS files).
In ExtendScript terms something like the snippets below (dummy code, will not run before defining the variables myEntireFilePath1 etc.):
For more than one file to be placed use an array:
var myFileArray = [myEntireFilePath1, myEntireFilePath2, myEntireFilePath3];
app.documents[0].placeGuns.loadPlaceGun(myFileArray);
One file example:
...var myFile = File(myEntireFilePath1);
app.documents[
Copy link to clipboard
Copied
@David André – populate the placeGun with a file (one IDMS file) or with an array of files (more than one IDMS files).
In ExtendScript terms something like the snippets below (dummy code, will not run before defining the variables myEntireFilePath1 etc.):
For more than one file to be placed use an array:
var myFileArray = [myEntireFilePath1, myEntireFilePath2, myEntireFilePath3];
app.documents[0].placeGuns.loadPlaceGun(myFileArray);
One file example:
var myFile = File(myEntireFilePath1);
app.documents[0].placeGuns.loadPlaceGun(myFile);
Also see:
http://jongware.mit.edu/idcs6js/pc_PlaceGun.html
Uwe
Copy link to clipboard
Copied
Perfect! Thank you!
What if you want to place a snippet at the same location that it was made - like when holding down the option-key when placing the snippet?
Copy link to clipboard
Copied
@David André – hm, good question…
You mean with the place() command, not with the placeGun?
I guess you have to examine (read out) the IDMS file for the original coordinates of the snippet.
Never had done this…
Uwe
Copy link to clipboard
Copied
I have to revive this thread.
What if you want to place a snippet at the same location that it was made - like when holding down the option-key when placing the snippet?
Today I had different results when using spread.place( idmsFile.idms ) in a loop through gathered IDMS files of a folder. One spread was added by every iteration of the loop for every snippet placed.
In my first attempt all objects in the placed idms file were positioned at the zero point of a spread.
Now I see that the original positions of the objects are maintained.
I'm coming back when I found the reason.
All tests running with InDesign CC 2019 version 14.0.1.209 on Windows 10.
Regards,
Uwe
Copy link to clipboard
Copied
I understand that when there is only one snippet to be placed in an inDesign document using JavaScript, we could do:
var myFile = File(myEntireFilePath1);
app.documents[0].placeGuns.loadPlaceGun(myFile);
Now my question is, what if I want to delete myFile after it's placed? How do I do that using JavaScript?
I'm thinkg maybe an eventListener like "afterPlace" would do the job, but I really have very limited knowledge of scripting, could somebody please help?
Thanks heaps.