Forum Replies Created
-
AuthorPosts
-
Peter KahrelParticipantThanks for the write-up, Mike!
The script could be improved a bit. If you add and/or remove any words from the word list and run the script again, it doesn’t remove the highlights of the words that are no longer high risk. It’s a simple addition, let me know if you’re interested in the update.
Peter KahrelParticipantGlad you liked it! Conditional text is very useful, though I never use it as conditional text, only ever to highlight various bits of text. One thing I use it for was mentioned by Matt in the article you mentioned, to highlight references to figures, maps, tables, etc.
Peter KahrelParticipantMarc’s excellent script doesn’t mark up words. But a script to highlight words in a text isn’t too hard.
First, create a text file that contains all your risk words and save it in the document’s folder under the name risk-words.txt
Then run the below script. It creates a text condition and applies that condition to all the risk words. The advantage of txt conditions is that they don’t show in print (or PDF), or in InDesign’s Preview mode.
(function () { var condition; var riskWords; function getCondition () { app.documents[0].conditionalTextPreferences.showConditionIndicators = ConditionIndicatorMode.SHOW_INDICATORS; var c = app.documents[0].conditions.item('Risk word'); if (!c.isValid) { c = app.documents[0].conditions.add ({ name: 'Risk word', indicatorColor: UIColors.YELLOW, indicatorMethod: ConditionIndicatorMethod.useHighlight }); } return c; } function highlight (word) { app.findTextPreferences.findWhat = word; var w = app.documents[0].findText(); for (var i = w.length-1; i >= 0; i--) { w[i].applyConditions (condition); } } function getWords () { var f = File (app.documents[0].filePath + '/risk-words.txt'); if (f.exists) { f.encoding = ('utf-8'); f.open('r'); var w = f.read().split(/[\r]/); f.close(); return w; } return null; } app.findTextPreferences = app.findChangeTextOptions = null; app.findTextPreferences.properties = { caseSensitive: false, wholeWord: true, includeLockedStoriesForFind: false, } condition = getCondition(); riskWords = getWords(); if (!riskWords) { alert ('Risk words not found'); exit(); } for (var i = riskWords.length-1; i >= 0; i--) { highlight (riskWords[i]); } }());June 21, 2023 at 8:08 am in reply to: Has anyone set endnotes keyed to phrases and line or page numbers? #14393182
Peter KahrelParticipantJust for the record: I sent Jim the sample document and the script, and now it’s available here
June 18, 2023 at 2:42 am in reply to: Has anyone set endnotes keyed to phrases and line or page numbers? #14393093
Peter KahrelParticipantJim: Endnotes keyed to phrases and page numbers are in fact a kind of table of contents, and you can set them up as such.
The idea is to create the text of the endnotes in text frames anchored at the reference. For ease of identification, mark the key phrase in the text as conditional text (shows in the preview, doesn’t print). Those frames must be partially on the page otherwise the TOC won’t pick them up, but those frames can be set not to print. All this (and more) can be set up in an object style. The key phrases are in those frames as well.
Define the TOC style to place the page number before the entry, and when you generate the TOC you’re basically done. The formatting of the key phrases is handled by a nested style.
One thing that needs to be handled by a script is the removal of identical page numbers in the TOC, but that’s very simple.
Unfortunately I can’t attach the document here that shows the set-up. And I can’t manage to include a screenshot that shows what it looks like. If you send me an email at pkahrel@gmail.com I’ll send you the InDesign document.
Peter
Peter KahrelParticipantYep, InDesign documents can have just one index. But there are various workarounds. The simplest is to mark up the second index by adding a prefix in the sort-order field such that items with that prefix are placed at the end. (In a Latin-script index you’d use the prefix ‘zzz-‘.) Technically you still have one index, but when you generate the index all the prefixed items are together at the end of the index. All you need to do is add a title.
Another, more elaborate, way to do this is to create two topics, say, “Cyrillic 1” and “Cyrillic 2”, and add topics of either index as subtopics under the relevant main topic. When you generate the index, the level-1 topics (Cyrillic 1 and Cyrillic 2) are in effect the titles of the indexes, and the level-2 topics are in fact level-1 topics. It’s easy to style them correctly in the paragraph style definitions.
Peter KahrelParticipantThis one seems to work:
^.+(?<!https): -
AuthorPosts
