Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

javascript / pen tool / help!

New Here ,
Oct 09, 2020 Oct 09, 2020

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++;
}
}
}

TOPICS
Scripting
796
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 11, 2020 Oct 11, 2020

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

...
Translate
New Here ,
Oct 09, 2020 Oct 09, 2020

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++;
}
}
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 09, 2020 Oct 09, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 10, 2020 Oct 10, 2020

2020-10-10 171756.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2020 Oct 11, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 12, 2020 Oct 12, 2020
LATEST

Thank you for your help. Manan
I solved the problem because of you.

Have a nice day.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines