Forum Replies Created
-
AuthorPosts
-
Peter KahrelParticipantSo you want to insert the footnote number. But InDesign adds that when you create the footnote.
Peter KahrelParticipantYou find that the way you find the script code for any InDesign marker: insert it in the Find/Change dialog and you’re there. In this case, open the Find/Change dialog, click the @ next to the ‘Find what’ field, click ‘Markers’ then ‘Footnote reference marker’. You’ll now see ~F in the ‘Find what’ field and that’s what you use in your script:
app.findGrepPreferences.findWhat = ‘~F’;
(or ^F if you use text rather than grep).
Peter
Peter KahrelParticipantWell, Michel, care to share how you obtain the selected pages in the Pages panel?
P.
Peter KahrelParticipantI have used this script for that:
(function () { var stories = app.documents[0].stories; var ix; for (var i = stories.length-1; i > -1; i--) { while (stories[i].textFrames.length > 0) { ix = stories[i].textFrames[-1].parent.index; stories[i].textFrames[-1].texts[0].move (LocationOptions.AFTER, stories[i].insertionPoints[ix]); if (stories[i].textFrames[-1].locked) { stories[i].textFrames[-1].locked = false; } stories[i].textFrames[-1].remove(); } } }());January 29, 2019 at 2:32 am in reply to: Search for different indent sizes with one command? #113995
Peter KahrelParticipantUnfortunately that’s not possible. Please submit a feature request (at https://indesign.uservoice.com).
P.
Peter KahrelParticipantMissed that… Change this line:
if (cells[j-1].contents == '')to this:
if (cells[j].contents == '')P.
Peter KahrelParticipantAha, ok. So if a period on the baseline is followed by a superscripted number, the period and the number need to be swapped. If that’s what you want, then that’s not possible just like that because in InDesign you can’t search for two items with different formatting. So if you search for (\.)(\d+) you can’t specify that the dot should be normal and the number in superscript. You can use a three-step approach for this: expose the superscript as a text tag, do the change, and revert the superscript code. As follows:
1. Find what: (\d+)
Change to: %sup%$1
Find format: position superscript
Change format: position normal.12 is now changed to .%sup%12
You can use any text tag you like.2. Find what: \.(%sup%\d+)
Change to: $1.
(Blank the Find format and Change format panels)3. Find what: %sup%(\d+)
Change to: $1
Find format: leave blank
Change format: position superscript.P.
Peter KahrelParticipantIt’s not so clear what’s going wrong. And that script is rather inefficient — here is another approach:
var i, j, cells; // Get all the rows in the document var rows = app.documents[0].stories.everyItem().tables.everyItem().rows.everyItem().getElements(); for (i = 0; i < rows.length; i++) { // Get all the cells in a row cells = rows[i].cells.everyItem().getElements(); for (j = cells.length-1; j >= 1; j--) { if (cells[j-1].contents == '') { cells[j-1].merge (cells[j]); } } }P.
Peter KahrelParticipantWhat is an online dot? Better show a screenshot that shows what you have now and how you would like it to be.
P.
Peter KahrelParticipantparagraphstyles should be paragraphStyles (JavaScript is case-sensitive). But it’s spelled correctly in your code. And your script works fine.
P.
Peter KahrelParticipantI suggest that you get in touch with https://www.id-extras.com/. They have done excellent work on INDesign footnotes (and they’re in Israel).
P.
Peter KahrelParticipantSaw Kal’s post only a minute ago. Now why didn’t I think of GREP :)? But it can be done simpler:
Find what: (.)\Z
Replace with: $1-X(.)\Z matches any character at the end of a story and replaces it it with itself and -X
P.
Peter KahrelParticipantA simple script:
frames = app.documents[0].textFrames.everyItem().getElements();
for (i = 0; i < frames.length; i++) {
frames[i].contents += ‘-X’;
}If there’s any formatting in the frames you need the slower version:
frames = app.documents[0].textFrames.everyItem().getElements();
for (i = 0; i < frames.length; i++) {
frames[i].insertionPoints[-1].contents = ‘-X’;
}P.
January 9, 2019 at 9:08 am in reply to: Is it possible to link same position text boxes on multiple page with a script? #113440
Peter KahrelParticipantYou have to be able to identify text frames on the document pages, and the easiest way to achieve that would be to name them on your master pages. So if you have two text frames on each page, one at the top and one at the bottom, name the top one ‘A’ on the Layers panel. Then override the top frame on the first page and place text in it. The frame will be overset. Now write a script that, while the story is overset, adds a page, overrides frame ‘A’, and links it to the previous frame ‘A’. You can do that with as many frames as needed, call them ‘B’, ‘C’, etc.
Peter KahrelParticipantYou can look for a space, then take the distance between the first and the second horizontal offsets. And compare that with your ‘certain measurement’.
P.
-
AuthorPosts
