Created
June 3, 2010 06:20
-
-
Save osima/423546 to your computer and use it in GitHub Desktop.
InDesignのXMLへのアクセス
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// InDesign ドキュメントのXMLツリーから 要素 "Image" を探し出し、その position 属性の値を表示. | |
// | |
function procImage( eImage ){ | |
var attrs = eImage.xmlAttributes | |
for(var i=0; i<attrs.length; i++){ | |
var attr = attrs.item(i); | |
if( attr.name == 'position' ){ | |
alert( attr.value ); | |
} | |
} | |
} | |
function trace( xmlele ){ | |
for( var i=0; i<xmlele.xmlElements.count(); i++){ | |
var e = xmlele.xmlElements.item(i); | |
if( e.markupTag.name == 'Image' ){ | |
//alert( e.markupTag.name ); | |
procImage( e ); | |
} | |
trace( e ); | |
} | |
} | |
var doc = app.activeDocument; | |
var eRoot = doc.xmlElements.itemByName("Root"); | |
trace( eRoot ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment