Copy link to clipboard
Copied
hi. Help me!
JavaScript Inserts Image into a rectangles Made of Pan tool
var i = 0;
for (var p = 1; p <= myPages.length - 1; p++) {
for (var n = 1; n <= 10; n++) {
if (i <= myOutGroupPics1.length - 1) {
myPages[p].rectangles
.item("myOutdoorGroup" + n)
.place(File(myOutGroupFolder1 + "/" + myOutGroupPics1[i].name));
i++;
}
}
}
1 Correct answer
If you have the selection of the object you can place the image into it as follows
app.selection[0].place(File("/Users/manan/Downloads/download.jpeg")) //Change the path
If you have a name applied to the object that will help you identify it, similar to what you are doing in your code, you could do the following
app.documents[0].pageItems.itemByName("test").place(File("/Users/manan/Downloads/download.jpeg"))
Here test is the name of the object(visible in the layers panel, you can change it to a
...Copy link to clipboard
Copied
var i = 0;
for (var p = 1; p <= myPages.length - 1; p++) {
for (var n = 1; n <= 10; n++) {
if (i <= myOutGroupPics1.length - 1) {
myPages[p].rectangles(What should I change this place to?)
.item("myOutdoorGroup" + n)
.place(File(myOutGroupFolder1 + "/" + myOutGroupPics1[i].name));
i++;
}
}
}
Copy link to clipboard
Copied
What are you trying to do, can you send the sample document and show me what you are trying to place and into which element?
-Manan
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you have the selection of the object you can place the image into it as follows
app.selection[0].place(File("/Users/manan/Downloads/download.jpeg")) //Change the path
If you have a name applied to the object that will help you identify it, similar to what you are doing in your code, you could do the following
app.documents[0].pageItems.itemByName("test").place(File("/Users/manan/Downloads/download.jpeg"))
Here test is the name of the object(visible in the layers panel, you can change it to anything that you want)
-Manan
Copy link to clipboard
Copied
Thank you for your help. Manan
I solved the problem because of you.
Have a nice day.

