Forum Replies Created
-
AuthorPosts
-
Peter KahrelParticipantEdward — In what way can you not get it to work? What have you tried? Do you see an error message? Does something happen but not what you expected? Does nothing happen at all? The script works on the first section of every open document. To target all sections in a single document, do this:
app.documents[0].sections.everyItem().continueNumbering = true;
And you could even target all sections in all open documents:
app.documents.everyItem().sections.everyItem().continueNumbering = true;
And, finally, in case you want to open all documents in a book, here’s another one-liner:
app.open (app.activeBook.bookContents.everyItem().fullName);
There are many one-liners!
Peter
Peter KahrelParticipantThe Save dialog does indeed virtually look the same as the Open dialog. At first sight the difference is only in their titles, ‘Select a script’ vs. ‘Save the script’. On Windows (which I use) it works fine though:
1. Click Save
2. At the ‘File name:’ prompt, type a name for the script and click OK (or press Enter/Return). No need for a file type, .jsx is added automatically.I have some screen shots but I can’t show them here. I’ll send them to David.
If neither of you can get it to work then it must be a Mac thing. In which case I’ll have to think of some fix.
Peter
Peter KahrelParticipantGopa’s solution works, and at the same time it’s a nice illustration of how useful GREP is. To delete amounts before the Euro symbol, do this:
Find what: \d[\d.\x20]*?(?=€)
Change to:In normal mortals’s words: ‘find a digit followed by any string of digits, dots and spaces, only if it/they is/are followed by the Euro symbol’.
P.
Peter KahrelParticipantapp.documents[0].stories.everyItem().composer = “$ID/HL Composer Optyca”;
Peter KahrelParticipantThis works: select an an insertion point in any cell, then do this:
cell = app.selection[0].parent.parentRow.cells[0];
table = cell.parent.parent;
table.rows.itemByRange(cell,table.cells[-1]).select();In other words, select the rows from the first cell in the selected cell’s row to the table’s last cell.
A convoluted and non-intuitive way to go about it, but there you are!
Peter
Peter KahrelParticipantIt’s not entirely clear what you’re after. Please elaborate.
November 28, 2019 at 8:42 am in reply to: Make an array of H&J violations for processing with script #14323500
Peter KahrelParticipantH&J violations aren’t exposed to scripting, you’ll have to go and look for them yourself. Which is possible, but it’ll be a slow script. To find violations in word spacing, for example, you first need the width of a space in a non-justified line of ext (typically the last line of a paragraph, or place a small temporary text frame, apply the paragraph style, enter a space, and measure its width. Then go through every line of text, measure the width of the first space and determine its scale compared with the standard space. Compare that with the minimum and maximum in the Justification panel.
November 25, 2019 at 8:31 am in reply to: Make an array of H&J violations for processing with script #14323523
Peter KahrelParticipantThat’s the way to do it.
November 25, 2019 at 5:41 am in reply to: Make an array of H&J violations for processing with script #14323527
Peter KahrelParticipantH&J violations aren’t exposed to scripting, you’ll have to find them yourself. Which is possible, but it’s a slow bussiness. For example, to find word-spacing violations, you first find the width of a standard space (i.e. a space in a non-justified line of text). You then go through the text and in each line of text and get the width of the first space. Determine the percentage by which that space was scaled, then compare that percentage with the minimum and/or the maximum value set in the Justification panel.
Peter KahrelParticipantYou posted this in the Adobe’s InDesign forum as well. See the response there.
p.
November 8, 2019 at 10:10 am in reply to: Script to Replace Existing Paragraph Styles With New Style #14323769
Peter KahrelParticipantFor a single document or a small handful of documents your method would certainly the recommended method, Jeremy. But when you have 1,000 files…
November 8, 2019 at 6:11 am in reply to: Script to Replace Existing Paragraph Styles With New Style #14323782
Peter KahrelParticipantI’ll try again.
(function () {
var pstyles = app.activeDocument.allParagraphStyles;
for (var i = 1; i < pstyles.length; i++) {
if (pstyles[i].appliedFont.fontFamily == 'Arial') {
pstyles[i].appliedFont = 'Roboco';
}
}
}());
November 8, 2019 at 6:05 am in reply to: Script to Replace Existing Paragraph Styles With New Style #14323783
Peter KahrelParticipantDavid — This script: https://www.kahrel.plus.com/indesign/batch_convert.html is a general batch processor. You can run a script with it as well, see the section ‘Run a script’ on that page.
The script I posted above needs some changes before you can use it in the batch processor:
(function () {
var pstyles = app.activeDocument.allParagraphStyles;
for (var i = 1; i < pstyles.length; i++) {
if (pstyles[i].appliedFont.fontFamily == 'Arial') {
pstyles[i].appliedFont = 'Roboco';
}
}}());
Peter
October 31, 2019 at 1:23 am in reply to: Script to Replace Existing Paragraph Styles With New Style #14323820
Peter KahrelParticipantYou should leave out those
tags. I couldn’t edit the code any longer after five attempts.October 31, 2019 at 1:16 am in reply to: Script to Replace Existing Paragraph Styles With New Style #14323822
Peter KahrelParticipantSomething like the following script changes Arial to Roboto only in paragraphs that use Arial. Dependencies (through basedOn) should carry over. A potential problem is font styles in Arial not present in Roboco, But if you use just, say, Regular and Italic you should be ok. The proof of the pudding…
pstyles = app.activeDocument.allParagraphStyles;<br /> for (i = 1; i < pstyles.length; i++) {<br /> if (pstyles[i].appliedFont.fontFamily == 'Arial') {<br /> pstyles[i].appliedFont = 'Roboco';<br /> }<br /> }P.
-
AuthorPosts
