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
function getTypeArea(page) { | |
typeArea = {}; | |
typeArea.y1 = page.marginPreferences.top; | |
typeArea.x1 = page.side == PageSideOptions.LEFT_HAND ? page.marginPreferences.right : page.marginPreferences.left; | |
typeArea.y2 = page.bounds[2] - page.marginPreferences.bottom; | |
typeArea.x2 = page.side == PageSideOptions.LEFT_HAND ? page.bounds[3] - page.marginPreferences.left : page.bounds[3] - page.marginPreferences.right; | |
typeArea.geometricBounds = [typeArea.y1, typeArea.x1, typeArea.y2, typeArea.x2] | |
typeArea.height = typeArea.y2 - typeArea.y1; | |
typeArea.width = typeArea.x2 - typeArea.x1; |
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
function getNextPage(page) { | |
var dok = page.parent.parent; | |
var nextPage = dok.pages[page.documentOffset+1]; | |
if (!nextPage.isValid) { | |
nextPage = dok.pages.add(); | |
nextPage.appliedMaster = page.appliedMaster; | |
} | |
return nextPage; | |
} |
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
function pt2mm(numberInPt) { | |
return ( numberInPt * 25.4 ) / 72; | |
} | |
function mm2pt(numberInMm) { | |
return ( numberInMm * 72 ) / 25.4; | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?whitespace-handling use-tags?> | |
<test xmlns:aid3="http://ns.adobe.com/AdobeInDesign/3.0/"> | |
<p>Test Tab:<aid3:tab/>End of Paragraph here:<aid3:br/>End</p> | |
</test> |
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
var myObject = {text:"a\rz"}; | |
var json = myObject.toSource().replace(/\r/g,"\\r"); | |
var myObject2 = eval(json); | |
$.writeln(myObject2.text) |
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
function getAllTables(dok) { | |
allTables = []; | |
app.findTextPreferences = NothingEnum.NOTHING; | |
app.findTextPreferences.findWhat = "<0016>"; | |
var result = dok.findText(); | |
for (var i =0 ; i < result.length; i++) { | |
allTables[i] = result[i].tables[0]; | |
} | |
return allTables; | |
} |
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
// Based on Marc Autret Idea http://www.indiscripts.com/post/2011/10/how-to-detect-a-ghost-item | |
var isGhost = (frame.parent instanceof Character) && (!frame.parent.parentTextFrames.length || frame.parent.parent instanceof XmlStory); |
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
function getVersion() { | |
var version = parseFloat(app.version).toFixed (1); | |
return (version % 1 == .5) ? version : Math.floor(version).toFixed(1); | |
} |
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
var root = app.activeDocument; | |
var result = getStyleByString(root, "Formatgruppe 2:Form\\:atgruppe 1:Zeichen\\:\\:format 1", "characterStyles", true); | |
$.writeln(result.name); | |
function getStyleByString(root, string, property, recreate) { | |
if (recreate == undefined) recreate = false; | |
stringResult = string.match (/^(.*?[^\\]):(.*)$/); | |
var cStyleName = (stringResult) ? stringResult[1] : string; | |
cStyleName = cStyleName.replace(/\\:/g, ":"); |
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
function addStandardNameSpace(xmlContainer) { | |
if( !xmlContainer.xmlAttributes.itemByName("xmlns:xml").isValid ) { | |
xmlContainer.xmlAttributes.add( "xmlns:xml", "http://www.w3.org/XML/1998/namespace" ); | |
} | |
if( !xmlContainer.xmlAttributes.itemByName("xmlns:aid").isValid ) { | |
xmlContainer.xmlAttributes.add( "xmlns:aid", "http://ns.adobe.com/AdobeInDesign/4.0/"); | |
} | |
if( !xmlContainer.xmlAttributes.itemByName("xmlns:aid5").isValid ) { | |
xmlContainer.xmlAttributes.add( "xmlns:aid5", "http://ns.adobe.com/AdobeInDesign/5.0/"); | |
} |
OlderNewer