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
Group.prototype.addItems = function(/*PageItem[]*/newItems) | |
//---------------------------- | |
// Emulates Group.groups.add(items) | |
// [ Also supports Group.addItems(existing_item) ] | |
// <newItems> == Array of 2+ PageItem | |
// -> create a <newItems> subgroup in <this> | |
// <newItems> == single PageItem | |
// -> add the PageItem in <this> | |
// Returns the added subgroup or item | |
// (the whole group hierarchy is preserved) |
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
// Having a text frame selected. | |
// --- | |
var tf = app.selection[0]; | |
var lines = tf.lines.everyItem().contents; | |
var ranges = tf.textStyleRanges.everyItem().contents; | |
var lines_ranges = tf.lines.everyItem().textStyleRanges.everyItem().contents; | |
var result = | |
[ |
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(t,a,w,k,i,ff) | |
//---------------------------------- | |
// InDesign script. | |
// Show Grep/Text found items into a file. | |
{ | |
a = (t||0)&&('string'==typeof(app[(k='findGrep')+'Preferences'].findWhat)||'string'==typeof(app[(k='findText')+'Preferences'].findWhat)); | |
if(!a ) return; | |
w = new Window('palette',k); | |
w.margins = 25; |
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
// Test app.doScript from InDesign's modal state | |
// - Run this jsx from your Scripts panel and click`Test` | |
// - Feedback here: https://twitter.com/indiscripts | |
// --- | |
(function(w,s,u) | |
{ | |
const V = "ID " + app.version + " / " + $.os; | |
w = new Window('dialog',"Test doScript in Modal State"); | |
w.orientation = 'row'; |
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( w,t) | |
//---------------------------------- | |
// Testing UI Scaling vs. ScriptUI in Windows10 | |
{ | |
w = new Window('dialog',"test"); | |
w.margins = 60; | |
w.orientation = 'column'; | |
(w.blue = t = w.add('group')).minimumSize = [600,400]; | |
t.margins = 40; |
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
// This routine is part of IdExtenso framework. | |
// --- | |
ScriptUI.SCALING = (function(w) | |
{ | |
(w=new Window('palette','')).margins=0; | |
w.add('group').minimumSize=[500,500]; | |
w.layout.layout(1); | |
return [w.size[0]/500,w.size[1]/500]; | |
})(); |
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
// Assuming a text is selected (or cursor positioned) in a TextFrame. | |
// --- | |
var tf = app.selection[0].parentTextFrames[0]; | |
alert( tf.constructor.name ); // => TextFrame expected. | |
var dup = tf.duplicate(); // Duplicate the frame | |
dup.properties = { // Assign some props | |
contents:'test', | |
textFramePreferences:{ignoreWrap:true}, | |
locked:false |
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 'StyleToGrep' | |
// Experimental InDesign/ExtendScript/ScriptUI code for testing the idea of two interacting palettes. | |
// Discussion: https://community.adobe.com/t5/indesign/what-is-the-best-practices-to-call-palette-from-another-dialog/td-p/12154542 | |
// [DISCLAIMER] The below script is just a quick proof of concept. Do not use it in production. | |
if( 'function' != typeof $.global.StyleToGrep ) | |
{ | |
Object.prototype.setup=function(o,k){for(k in o)o.hasOwnProperty(k)&&(this[k]=o[k]);return this}; |
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 PageToRange = function(/*uint>0*/p, q) | |
//---------------------------------- | |
// Returns the 1-based range index containing page number `p`. | |
// (The last range supports any `p` beyond the maximum.) | |
// [REM] Use PageToRange.setup() to initialize the ranges. | |
// --- | |
// => uint [1 for 1st range, 2 for 2nd range...] | false [INVALID p] | |
{ | |
return p > 0 && ((q=callee.Q).charCodeAt(-1+p)||q.charCodeAt(-1+q.length)); | |
}; |
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" standalone="yes"?> | |
<?aid style="50" type="snippet" readerVersion="6.0" featureSet="257" product="17.0(105)" ?> | |
<?aid SnippetType="PageItem"?> | |
<Document DOMVersion="17.0" Self="d"> | |
<PastedSmoothShade Self="PastedSmoothShade/ude" ContentsVersion="0" ContentsType="RadialShade" SpotColorList="" ContentsEncoding="Ascii64Encoding" ContentsMatrix="1 0 0 1 0 0" Name="$ID/" ColorEditable="true" ColorRemovable="true" Visible="false" SwatchCreatorID="7937" SwatchColorGroupReference="n"> | |
<Properties> | |
<Contents><![CDATA[QA+hbGAAAAAAAAAAAAAAAL/iNOEgAAAAQA9TSsAAAABAgsDVoAAAAEBjbRaAAAAAAAEAAQAAAAAA | |
AAACAAAABAAAAAAAAAABAAAAAQAAAAAAAQAAAAAAAAAAP/AAAAAAAAAAAAAAAAEAAAAAAAAAAD/w | |
AAAAAAAAAAAAAQAAAAEAAAAAAAAAAEB7IAAAAAAAAAAAAQAAAAAAAAAAP/AAAAAAAAAAAAAAAbMA | |
AAAIAAABs1BQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFFRUVFR |
OlderNewer