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

How does everyItem().name work?

New Here ,
Nov 09, 2011 Nov 09, 2011

Copy link to clipboard

Copied

Hello,

I have found in some other post or howto the following InDesign Javascript line, which gives me an array with all names of the pdf export presets.

var availablePdfPresets = app.pdfExportPresets.everyItem().name;

I am curious how this technically works.

app.pdfExportPresets

gives me an object (PDFExportPresets) which has an function "everyItem()". So far so good. But how does the 

everyItem().name;

combines all "name" properties from the different pdf export preset objects to one array?

This does not affect my current work, but I would like to understand the techniques behind. And perhaps I might be able to use this knowledge some day in my own projects.

Is anybody able to explain this?

TOPICS
Scripting

Views

658

Translate

Translate

Report

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
People's Champ ,
Nov 09, 2011 Nov 09, 2011

Copy link to clipboard

Copied

Some here will be able to explain this better than I can. But consider

that everyItem().getElements() returns an array of all the objects (ie

app.documents.everyItem().getElements() will return an array of all the

documents.)

So everyItem().name returns an array of only the name of the elements,

rather than the entire elements themselves, which you can get with

getElements().

everyItem() is like a "potential" list of all elements, but InDesign

does not actually access all those elements until your bring it down to

earth with something like getElements().

As I say, others here can explain this better. I remember reading about

this on, I think, Marc Autret's website, but I don't have the link to

hand. He has an excellent exposition of this entire subject.

Ariel

Votes

Translate

Translate

Report

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 ,
Nov 09, 2011 Nov 09, 2011

Copy link to clipboard

Copied

LATEST

Arïel wrote:

As I say, others here can explain this better. I remember reading about

this on, I think, Marc Autret's website, but I don't have the link to

hand. He has an excellent exposition of this entire subject.

Thank you very much. Your hints and a Google search led me to the correct entries on his website:

http://www.indiscripts.com/post/2010/06/on-everyitem-part-1

http://www.indiscripts.com/post/2010/07/on-everyitem-part-2

These posts describe this in detail. Thank you!

Votes

Translate

Translate

Report

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