Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberAdding transparency might have side effects,though. Is it possible to set an object to Non-Printing in the Find/Change Object dialog?
Theunis De Jong
MemberFurry, feel free to correct me if I'm mistaken …
… the Find//Change dialog box, whilst it has a tab called “Object” that tab does not offer the possibility of finding an object by its Object Style.
… in my InDesign CS4, I find that the Find Object dialog does allow you to select any pre-defined Object Style. Just select the category “Style Options”, and at the right hand side of the dialog you can select your particular style from the drop down list.
Other than in the Text Find & Change, you cannot replace an object with 'Nothing'; but you can use the Find Next hot key … oh wait, you can't (it seems this defaults back to Find Text). Well, you can use the Find Next button then.
Theunis De Jong
MemberBecause InDesign is not an e-pub designer.
February 7, 2013 at 2:51 pm in reply to: Replace character between any digit withouf effecting the digits #64094Theunis De Jong
MemberDavid, nothing makes me sit quicker up than a chance to show off GREP to someone for the first time. :)
Pre-GREP, I used a slight variation on Sandee's trick — I used to create a custom color swatch, so I could see what was happening, and when finished all I had to do was delete the swatch and replace it with black. A three-step approach — when GREP was added to ID's toolkit this became a one-step process.
This particular search has been in my FindChangeByList list for years. I also have one that works for roman numbered ranges …
February 7, 2013 at 6:58 am in reply to: Replace character between any digit withouf effecting the digits #64084Theunis De Jong
MemberFor that you need to use the GREP tab of the Search-and-Replace dialog. Switch to that, then enter
(?<=d)-(?=d)
in the Find What field, and
~=
in the Replace With field.
GREP is about halfway between a regular text search and a full programming language; certain characters are found 'as usual', where other single or multiple character sequences are actually codes that trigger some specific behavior. For GREP, the special codes for 'any digit' is d and it works just like the regular ^9, but the extra codes around it: (?<=..) and (?=..) form Lookbehind and Lookahead sequences. These do the magic: the text inside is matched (i.e., it should be found) but it is not included in the Replace operation. So whatever digits are found, they are never removed; only the single hyphen inside is actually replaced with whatever you put in the Replace With field.
See FindBetween: A Useful GREP String for a couple more examples, and the overview page GREP for a list of relevant pages.
February 6, 2013 at 3:30 pm in reply to: Do forced line breaks always interrupt a Paragraph Style? #64079Theunis De Jong
MemberAh — and it's an 'x' because Unicode codes are best expressed in hexadecimal numbers.
Perhaps this is a bit of GREP's history shining through, as the prefix “x” serves to insert a random hex character into a C string — and “C” was the language of choice in the era when GREP was originally conceived.
February 6, 2013 at 3:26 pm in reply to: Do forced line breaks always interrupt a Paragraph Style? #64078Theunis De Jong
MemberIt inserts the character's Unicode directly as a character. U+0020 is the Unicode for a regular space, so x{20} inserts it (you may drop the leading zeros). Knowing this is quite handy if you want to insert characters for which your OS doesn't provide a default key and which do not have a predefined shortcut, such as ~= for the en-dash. Also, you don't have to hunt the character down in the Glyphs panel, insert it in your document, then use copy-and-paste. The Glyphs panel shows a character's Unicode when you hover the mouse over it.
I use this to insert stuff like x{2212} — a real minus — and the odd Greek character code — x{3b1} is the alpha — into GREP searches and styles.
Since a typed space does not appear visibly in this forum, I used the Unicode form here. It's all the same for InDesign.
(By the way, the forum software eats backslashes. To get one in your post, type two \'s.)
February 4, 2013 at 4:54 pm in reply to: Do forced line breaks always interrupt a Paragraph Style? #64061Theunis De Jong
MemberAre you using Nested Styles or GREP styles? I couldn't get your original to work with Nested Styles, so for sake of argument let's assume you didn't use those :)
I get your original result with this GREP style:
^.+?x{20}x{20}
(I actually used two simple spaces, but this way they show up in the post.) It says, “from the start of the current paragraph, grab as little as you can up to two spaces” — only less verbose.
The problem lies in the caret ^ — according to your average GREP manual, it stands for “Beginning of Paragraph”. (Wait, let me check. … Yup, ID's Online Help on “Metacharacters for searching” says exactly that.) Now what is the 'beginning of a paragraph'? Why, surely that's (1) at the start of a story (or table cell or footnote), or (2) immediately after a Hard Return! .. Unfortunately, no. It's true for Nested Styles, but not for GREP (both when searching or in a style)!
I guess it's one of those things that came with GREP. Adobe's programmers didn't write it from the ground up, but opted to use a well-tried-and-tested open source library (“boost”, https://www.boost.org). They added a few bits here and there around the edges (most notably, shortcuts for a lot of InDesign's special characters), but the main bulk was left unchanged. Looking at the source code, one can forgive them for overlooking the fact that “n” — the soft return — gets treated very much the same way as “r” — the hard return. Historically, there always has been some overlap between these two codes; it's totally “normal” to find text files containing either “n” or “r” at the end of each paragraph (and only Microsoft could come up with a scheme that proscribes “rn” — or was it the other way around? –, and woe on you if you feed an edit box the wrong order!). So boost takes the safe route and treats them exactly the same: both 'r' and 'n' signify “the Beginning of a Paragraph”.
Unfortunately, GREP styles rely entirely on what the boost code says; and the boost code says, “hey, here is the start of a paragraph”. Fortunately, ID does recognize the difference if you explicitly test for either an 'r' or an 'n' code. The 'r' code is a bit of a trouble maker inside a GREP style (because “GREP styles do not span multiple paragraphs”, and I guess they get filtered out of the expression at an early stage), but if you are “at the beginning of a paragraph” you can test if you are 'next to a soft return'!
So this GREP Style code will work for you:
^(?<!n).+?x{20}x{20}
— at the “Beginning of Paragraph” position, there may be 'nothing' to the left (at the start of a story), or there may be a hard return. So if you only match if there is “not a soft return”, you are safe!
[*] One could make a case to Adobe that this is faulty behavior, and submit it as a Bug Report, since it's contrary to expectations and different from what Nested Styles do.
Theunis De Jong
MemberIf my version is what you are using, yes, preptext is indeed oblivious of colors. In David's very own Blatner Tools, however, allows both basic formatting (what preptext does) and advanced formatting to be encapsulated into styles: https://www.dtptools.com/produc…..e=features
Theunis De Jong
MemberFinding stuff is relatively easy with a script, but it's quite hard to make it 'interactive'. That is, if you need functionality such as 'find next', 'find in current story', or even 'find previous' (a function that Adobe feels unnecessary, even in CS6), one needs a large script.
In addition, just like in the UI, you cannot do a plain search for “not x“. You must inspect every single item, one at a time.
If you only need to find the very next occurrence and you always correct it immediately, then you could use this:
cstyles = app.activeDocument.stories.everyItem().textStyleRanges.everyItem().getElements();
for (i=0; i!=cstyles.length ;i++)
{
if (cstyles[i].verticalScale != 100)
{
app.select(cstyles[i]);
app.layoutWindows[0].zoomPercentage = app.layoutWindows[0].zoomPercentage;
}
}… It always restarts searching from the very start of your document, so if you leave even just one occurrence unchanged, the script will always stop at that point.
Do you reset the vertical scale to 100%? I imagine you don't, since the horizontal scale should also be adjusted. But if you do, you could replace the inner two commands with this single one:
cstyles[i].verticalScale = 100;.. although the end result is not different from “Select All” and then setting the vertical scale for all text at once ..
Theunis De Jong
MemberCopy/paste of my script seems to be backwards!
Anyway, yes: it is possible to limit Find/Change to just one paragraph style, much as you could do it in the interface itself: all you need to add is the actual paragraph style name to be searched in.
Add this line
app.findGrepPreferences.appliedParagraphStyle = “Your Style Name Here”;
right before the line that says “app.activeDocument.changeGrep();”
(Make sure you enter the correct paragraph style name in the new line.)
Theunis De Jong
MemberIt's suprisingly easy. The scripting interface knows what 'layout window' you are looking at (in case you have several windows and/or documents opened), and it knows what page or spread is selected inside that window. Both a Spread and a Page have a “duplicate” method, which does exactly what it says — always a nice surprise –, and you also can indicate where the duplicate should be placed.
This one-liner will duplicate the current spread:
app.layoutWindows[0].activeSpread.duplicate (LocationOptions.AFTER, app.layoutWindows[0].activeSpread);and this one the current page:
app.layoutWindows[0].activePage.duplicate (LocationOptions.AFTER, app.layoutWindows[0].activePage);Note that in the latter case it's slightly ambiguous what the 'current page' is when you are viewing a double spread. When both pages are selected in the Pages panel, the script uses the leftmost page. To be sure what page gets duplicated, use Shift+PgUp and Shift+PgDn to zoom in on the specific page you want to duplicate.
Best of all: if you need this often, well, you can bind shortcut keys to scripts.
Theunis De Jong
MemberWell, did you mean “I tried and it didn't work” or did you mean “I have no clue on what to do”?
A TOC is generated by picking up a certain paragraph style — it's the way it works, and you must use paragraph styles. In your case, it would seem logical to just have it pick up the style used for captions.
Theunis De Jong
MemberAfter importing XML or tagging text and objects in the document itself, you can see the entire XML structure tree in this, as well as attributes, processing instructions, and comments.
When text is tagged, you can move it around inside an ID document by dragging its associated XML element to another position in the structure tree.
December 13, 2012 at 2:34 am in reply to: Shaded text set inside of a multi column text box – how? #63746Theunis De Jong
MemberIf the shading flows with the text, then it must be either a gray rectangle object anchored to the text position, or a custom underline. (The only two options I can think of — anyone else?)
If it's a custom Underline, you can edit the text “inside” it and the background will grow and shrink automatically. You can see if it's underlined text in the Character Panel and/or the Control Panel.
To check if it's a separate object, enable “Show Frame Edges” and “Show Hidden Characters” — the frame of the object ought to be visible. If it's an anchored rectangle, you might see the anchor pointer inside the text.
(Edit: by the way, your screenshot didn't show for me, so the above is guesswork.)
-
AuthorPosts
