Is it possible to select page items on an InDesign document associated with elements of IDML? It is written like this on idml-specification.pdf :
8.2 IDML Component Names An IDML component name can only be defined for a spread, story, or master spread. In an IDML package, each instance of these elements appears as a separate file. The component name is used as the file name for an object instance and it’s also used to refer to the file in designmap.xml. Note the component name does not change the value of the self attribute of the element.
8.2.4 Scripting Interface Component names can be accessed through the IDMLComponentName property on spread, story, and master spread objects.
Are they only spread, story and master spread objects? If so, can’t we mutually refer to other objects and their elements? For example text frame, rectangle and other things. I tried to test the matter with scripts.
- Selected any element of page items had attribute “Self” and got the value.
- Removed a character, u or U that was the first value of the attribute.
- Treated the value as hexadecimal digit sequence, and converted it to decimal digit sequence.
- Selected a page item using the decimal number on the document of InDesign. Used following the script:
display dialog "Enter a number for searching a page item." default answer ""
set id_number to (text returned of result) as integer
tell application "Adobe InDesign CS4"
tell active document
try
set a_object to page item id id_number
on error
tell application "Finder" to display dialog "It seemed that you entered the wrong."
error number -128
end try
if not (show_object of me given a_reference:a_object) then
tell application "Finder" to display dialog "It failed selecting the page item."
error number -128
end if
end tell
end tell
--------------------------------------------------------------------------------
on show_object given a_reference:a_object
tell application "Adobe InDesign CS4"
try
tell active window to set current_zoom_oar to zoom percentage
tell active document to select a_object
tell active window to set zoom percentage to current_zoom_oar
on error
return false
end try
return true
end tell
end show_object
The test was successful. It’s possible to access the page item using the value of Self attribute. But note when the IDML package was opened by InDesign, there are cases that a different UID was created on the document. Read following the paragraph:
8.2.3 Reset Component Name on Import When an IDML package is opened by InDesign, user-defined component names will be saved in the document so they can be used when the document is exported (that is, they are preserved for round-trip). Default names are not saved with the document because the object created during import may have a different UID. A new default name is generated when the document is exported.
It seems that when the document is exported is when an IDML package file is opened by InDesign application. In other words, when a IDML package is opened by InDesign application, there are nothing way to accuses page items(InDesign’s objects) on the document from elements I myself newly added to spread XML. The elements have not a key for accessing directly. If we try to find a page item associated with an element I made, it seems that we should make up a absolute path tracing a relative reference from spread’s, story’s and master spread’s element.
In a case of an element of IDML package that was exported from already existing InDesign’s document, of course it’s possible to access from the element. The opposite is true.
Would anybody tell me whether above my understanding is true or false?