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 script (function) -- DRAFT [230706] | |
// Cf https://community.adobe.com/t5/indesign-discussions/indesign-script-keep-reference-of-nested-pageitem-in-group-while-duplicating-it/td-p/13917002 | |
function indexPath(/*PageItem*/child,/*PageItem*/root,/*bool=0*/AS_SPEC, a,t,p,rk,tk,pk,i,o,x,s) | |
//---------------------------------- | |
// Assuming that `root` is a parent of `child` in the DOM hierarchy, returns | |
// a root-to-child path in the form of a `.<collection>[<index>]` sequence, | |
// each element being introduced by '.', e.g. `.textFrames[1].ovals[2].textFrames[0]` | |
// The result is then that `child === root.textFrames[1].ovals[2].textFrames[0]` | |
// --- |
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 testEventsPriority( w,g) | |
//---------------------------------- | |
// ScriptUI CS/CC - Modal dialog. | |
// Illustrates the distinctive priority of USER vs. PROGRAMMATIC events. | |
{ | |
// Global mousedown/mouseup listener. | |
const ON_MOUSE = function(ev, t) | |
{ | |
// this :: Window | |
if( (ev.target.properties||0).NoEvent ) return; // Used for the [Clear] action. |
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(/*any*/ev, ff,t,cond,bk,pf,x) | |
//---------------------------------- | |
// [This InDesign script CAN be used as a startup script.] | |
// Prompts a warning if the inside/left slug of the opened document is less than `MIN_SLUG`. | |
// Targeted event: afterOpen (app listener) | |
{ | |
const MIN_SLUG = 130; // in mm | |
const MM = +MeasurementUnits.MILLIMETERS; | |
if( (ev||0).isValid ) |
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(/*any*/ev, ff,t,cond,s,z) | |
//---------------------------------- | |
// [This InDesign script CAN be used as a startup script.] | |
// Prompts a warning if some UNembedded links exist in the doc; | |
// the save/saveAs task is then interrupted. | |
// [FIX230222] Made a confusion on the script purpose: | |
// now detect UNembedded links! | |
// Targeted events: beforeSave|beforeSaveAs | |
{ | |
const EMBD = LinkStatus.LINK_EMBEDDED.toString(); |
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 selPlacePDFPage( dt,doc,sel,t,ok,ff) | |
//---------------------------------- | |
// Simple interface for changing page in placed PDF. | |
// (Just select the PDF container and run.) | |
{ | |
dt = +new Date; | |
try | |
{ | |
doc = app.properties.activeDocument; | |
if( !doc ) throw "No active document."; |
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 script (DRAFT.) | |
//---------------------------------- | |
// Apply some text conversion routine on consistent | |
// style ranges *while preserving special characters* | |
// (anchored objects, tables, footnotes...) | |
function myConverter(/*str*/text) | |
//---------------------------------- | |
// Change a string into something else... |
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
#targetengine 'usernameVariable' | |
if( 'function' != typeof( $.global.afterOpenHandler ) ) | |
{ | |
afterOpenHandler = function(/*afterOpenEvent*/ev, doc,dt,str) | |
//---------------------------------- | |
{ | |
doc = ev.target; | |
if( 'Document' != doc.constructor.name ) return; |
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
// Hiding secret keys in listbox | |
// (ScriptUI CC Only.) | |
// --- | |
var dlg = new Window('dialog'); | |
var lst = dlg.add('group').add('listbox',void 0, | |
[ | |
'item1' + '\0secretKey1', | |
'item2' + '\0secretKey2', | |
'item3' + '\0secretKey3', | |
'item4' + '\0secretKey4', |
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
const urlMouseEventHandler = function onMouse(/*MouseEvent*/ev, st,ln) | |
//---------------------------------- | |
// this :: Group | |
{ | |
st = this.children[0]; | |
ln = this.children[1]; | |
switch( ev.type ) | |
{ | |
case 'mouseover': | |
case 'mousemove': |
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 graphicCellObjectBox(/*PageItem*/gco, dup,t,lt,rb,xy,dx,dy) | |
//---------------------------------- | |
// [DRAFT220802] Input: PageItem of a graphic cell. | |
{ | |
const AP_CC = +AnchorPoint.CENTER_ANCHOR; | |
const AP_TL = +AnchorPoint.TOP_LEFT_ANCHOR; | |
const AP_BR = +AnchorPoint.BOTTOM_RIGHT_ANCHOR; | |
const CS_IN = +CoordinateSpaces.INNER_COORDINATES; | |
const CS_PAR = +CoordinateSpaces.PARENT_COORDINATES; |
NewerOlder