Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberI forgot to add: the Pages panel display options are exactly those of CS4, but of course that has the Transparency Icon on by default.
Theunis De Jong
MemberCounting words is a sort of Black Art: What is a Word?
This script will open all of the documents in your book, count the words according to 2 different methods (I'm sure other scripters will find more ways), then display the results. Then choose which number to believe
//DESCRIPTION:Count Words Per Book
// A Jongware Script 18-Aug-2010
book = app.activeBook;
words_a = 0;
words_b = 0;for (var d=0; d<book.bookContents.length; d++)
{
doc = app.open (book.bookContents[d].fullName);
words_a += countWords_a (doc);
words_b += countWords_b (doc);
doc.close(SaveOptions.NO);
}
alert (“Number of words: “+words_a+”rOr possibly: “+words_b);function countWords_a (aDoc)
{
var w = aDoc.stories.everyItem().words.length;
return w;
}function countWords_b (aDoc)
{
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = “\w+”;
var w = aDoc.findGrep().length;
return w;
}August 18, 2010 at 1:28 am in reply to: Prevent stroke from changing dimensions position of frame? (cs4) #56724Theunis De Jong
MemberI still feel “Dimensions Include Stroke Weight” is what Hyland is looking for :)
August 17, 2010 at 2:59 pm in reply to: Prevent stroke from changing dimensions position of frame? (cs4) #56716Theunis De Jong
MemberCheck the Transformation panel popup menu — I think the setting you seek is in there.
Theunis De Jong
MemberIt seems to be off by default.
The usual: close all documents, switch on in Pages Panel menu/Panel Options, there you go.
Odd choice, Adobe.
Theunis De Jong
MemberSince you are new to InDesign, this will suffice (for the above equation; adjust for your own needs):
- drag out a new text frame and type “N (subscript) j” into it
- draw a horizontal line and position it somewhere below the N frame
- drag out a new text frame and type “Sigma N (subscript) j” into it.
- drag this frame to the correct position below the horizontal line
- select all three objects and group. Now you can move it around at will and place anywhere you want.
How could anyone automate this, for any equation? You tell me.
Theunis De Jong
Member1. Ask MathMagic.
2. What do you mean with “any way”? There is no hidden equation editor in InDesign, or something like that. I do things like these all the time, entirely manual:
Theunis De Jong
MemberSlightly easier is to use the Single-Line Modifier ?s — this puts GREP into “single line mode”, where ^ and $ will match start/end of story, and the period may also match a hard return (which it does not by default):
(?s)(?<=<XYZ>).+?(?=</XYZ>)
Afterthought: this will also apply the paragraph style to the first line containing the marker. If you don't want that and it's always followed by a hard return, use this:
(?s)(?<=<XYZ>r).+?(?=</XYZ>)
Theunis De Jong
MemberNot minus, use hyphens. But perhaps something else got formatted nicely :)
I've put the script onto my website: AlignNumbers.jsx — Download from there and save as “alignNumbers.jsx” into your Scripts folder (etc.); then, if it still fails it must be Some Other Error. I wrote & tested it using CS4, but I don't think there is something to make either CS3 or CS5 trip over.
Theunis De Jong
MemberEh!
That should be “add hyphen hyphen”, not “add en-dash” (!).
Theunis De Jong
MemberI agree with you both: if I can, I select an entire column and set a decimal tab. But there are occasions where I opt for Figure spaces — I even assigned a hotkey to it.
This script has been in the making for some time, because usually when I only have to align 1 or 2 numbers (or 3 or 4 or …), I set my mind on Blank and go moovin' that ol' cursor around an' hittin' the Figure Space shortcut, but all the while I'm thinking “hold on, there's got to be a better way”.
Surprisingly, this script is quite versatile: you can select any number of cells, horizontally, vertically, or even an entire Table. It uses a tiny GREP instruction to count the number of leading digits, so it will ignore anything that may come after it (such as decimal points, percentage signs, or a text such as “bottles of beer”). The longest decimal run count is saved, then it loops again over your selection, counting the digits that are in each cell and inserting Figure Spaces at the start to match the longest run.
Copy, paste into the ESTK Editor that came with InDesign. Save into your User Scripts folder, select any number of cells, then run the script:
//DESCRIPTION:Align Digits in Selected Column(s) in Table with Figure Spaces
// 11-Aug-2010 A Jongware Script
if (app.documents.length > 0 && app.selection.length == 1 && (app.selection[0] instanceof Column || app.selection[0] instanceof Cell || app.selection[0] instanceof Row || app.selection[0] instanceof Table))
{
txt = app.selection[0].cells.everyItem().contents;
longest = 0;
for (i=0; i<txt.length; i++)
{
nspan = txt[i].match(/^d+/);
if (!nspan) continue;
if (nspan[0].length > longest)
longest = nspan[0].length;
}
for (i=0; i<txt.length; i++)
{
nspan = txt[i].match(/^d+/);
if (!nspan) continue;
add = longest-nspan[0].length;
while (add– > 0)
app.selection[0].cells[i].texts[0].insertionPoints[0].contents = SpecialCharacters.FIGURE_SPACE;
}
} else
alert (“No table column(s) selected”);Theunis De Jong
MemberNo idea why it's designed that way. Perhaps it's swatches that were added later on, since you can just create any color you want using the RGB or CMYK sliders.
But of course you can use its pendant: add unnamed colors to swatches. That'll show you exactly what colors are applied, somewhere in your document.
August 2, 2010 at 5:33 am in reply to: InDesign CS5 Question: Finding a text in locked text frame #56547Theunis De Jong
MemberOne might guess that people were actually objecting to the CS3 and CS4 behavior: if you lock a frame to prevent it from changing and do a global replace on the “remaining” text, text in the locked frames was also changed. That could be called a bug.
In this case, CS5's behavior is more consistent: if you lock something, you cannot change it until you unlock it.
August 1, 2010 at 10:33 pm in reply to: InDesign CS5 Question: Finding a text in locked text frame #53464Theunis De Jong
MemberOne might guess that people were actually objecting to the CS3 and CS4 behavior: if you lock a frame to prevent it from changing and do a global replace on the “remaining” text, text in the locked frames was also changed. That could be called a bug.
In this case, CS5's behavior is more consistent: if you lock something, you cannot change it until you unlock it.
August 1, 2010 at 2:46 am in reply to: Script for changing Normal text to lowercase in paragraph styles #56543 -
AuthorPosts
