Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberThe question mark is indeed the cause of the malfunctioning.
By default, GREP is Greedy: the operators ?, +, and * will match as much as possible (right until the rest ofthe expression puts a stop on it). If an expression ends with one of these, it will continue matching as much as possible until the repeated expression no longer matches. A question mark changes this: after a ?, +, or * will make it match as *little* as possible.
So what happens on a string of digits, such as “abc123efg”? Using “\d+”, it will match the entire set of digits “123” — as long as possible. With the added question mark “\d+?” it will match *as little as possible* (while still being a valid expression), and so just “1” is already enough.
In the OP’s case this happens because the Repeat modifier is at the very end of the GREP expression. If there is anything in the epression *after* this Repeat modifier, such as “\d+?” (digits but with a next lowercase letter), then GREP has no other option than to match “123e”, because the shortest *possible* match MUST include all digits.
Theunis De Jong
MemberWhen saying you got “an” error message, it’s always useful to mention *which* one. (What if it is “Hard disk is full”?)
Theunis De Jong
MemberYou get your original spaces back because ‘$0’ inserts the exact entire found text again. You can use parentheses to indicate a part of the search string, and then use ‘$1’ to insert the first group in the Replace field, ‘$2’ for the second, etc. — up to 9 groups. But of course you can only ‘recall’ a numbered group in Replace if you defined it with parentheses in the Search field (and I bet that’s why your own attempts with ‘$2’ failed).
A second change is you do not have to list all of your search strings separately; after all there has to be only ONE character, out of a certain limited set, between your spaces.
All together, you can search for this
([+=~=×÷])
and replace with
~S$1~S
There was a single ‘?’ in your search query, and checking the rest I suppose it’s a copy-paste problem and it should have been the ‘multiply’ operator × instead. I would also rather use a *real* mathematical minus ‘-‘ (U+2212) rather than an en-dash, because it aligns with the ‘+’ and is a bit thicker (then again, not all fonts contain it).
Theunis De Jong
MemberNote that you don’t have to create separate masters for different counts of zeroes. Type ‘0000’ before your page number code, and set the Page Numbering to include three zeros in the Page Numbering -> Style dropdown list.
Theunis De Jong
MemberStuart, do you mean something like https://jongware.mit.edu/idcs6js/pc_Page.html#documentOffset — “The sequential number of the page within the document”?
This is the index of the nth PHYSICAL page in the entire document, disregarding any and all page numbering. Since it is a Javascript index, it starts at 0, NOT at 1, as a “page number” would.
Theunis De Jong
MemberJennifer, see David’s https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post.php —
“This has bugged novice InDesign users for years: You find a script on a forum thread or a blog post, but it’s just text… that is the scripter has pasted the text of the script in, so you can actually see the code. For experienced users (and scripters), that’s no big deal. But if you want to use that script, but you don’t know what to do with the code, read on.”
Theunis De Jong
MemberDavid, unless I am *very* mistaken the pattern is: “add 1 tab at the start of the line”.
(Oh wait, I am) Sorry; plus space-dash-space becomes tab-dash-tab.
Theunis De Jong
MemberThat’s exactly the behavior as described for ‘copy’: “Copies this object’s referenced file to the specified target location”. You are using “fontName” as new filename, and the file extension is no part of that. ‘location’ is way better: you get the ORIGINAL file name plus the ORIGINAL extension (your system will fail with ‘weird’ characters in the font name). On the downside, though, is that the ‘location’ also includes the entire path; and you somehow have to get rid of that.
Try this line (untested, but hopefully you get the idea):
fontName[i] = File(fontsUsed[i].location).name;
— it uses a dirty trick to get just the file name, but it should work.
Theunis De Jong
MemberThat string (and most of the others in a Font object) is just the font name as text. These texts are read out of the font *file*, but the filename can be just about *anything*. For example, I have a Stempel Garamond: fontFamily “Stempel Garamond LT”, fontStyleName “Roman”, fullName “Stempel Garamond LT Roman” — but the file itself is called “lt50277.pfb”.
What you are looking for is ‘location’: https://jongware.mit.edu/idcs6js/pc_Font.html#location (“The full path to the Font”).
Theunis De Jong
MemberCan’t do that either — GREP does not handle different paragraph styles. Doesn’t my mentioned “possible (tricky)” GREP work?
Theunis De Jong
MemberOuch :-) I would love to, but my boss would surely object! I’ve got a regular job at a design office.
For crash courses, you can check out IDSecrets’ GREP section: https://creativepro.com/resources/grep
.. and one of the most recommended guides on Using GREP with InDesign happens to be written by a Dutchman as well: Peter Kahrel’s “GREP in InDesign” (https://shop.oreilly.com/product/9780596156015.do)
Theunis De Jong
MemberMatt, it’s one of those things that I tried and tried and then *finally* googled … and what do you know, Benny Hill was right:
They said that it could not be done,
He said, “Just let me try.”
They said, “Other men have tried and failed,”
He answered, “But not I.”
…
They thought that it could not be done,
Some even said they knew it,
But he faced up to what could not be done…
And he couldn’t bloody do it!Theunis De Jong
MemberStill no problem ;-)
\([^)]*\u[^)]*\)
This looks for an opening parenthesis, then zero-or-more Not-Close-Paren, followed by an uppercase character, followed by zero-or-more Not-Close-Paren and finally followed by a closing parenthesis.
The Not-Close-Paren sequences are necessary because essentially you want to skip a list of “Not-A-Capital” — which is possible, but that also includes the closing parenthesis. In your example it would start at “(this one..” and end after the “A)”, picking up everything in between as well.
Theunis De Jong
MemberRead https://creativepro.com/the-importance-of-paragraph-composition.php …
If that text is left or right justified, this might also be due to “Balance Ragged Lines”.
Theunis De Jong
MemberPossibly you made a mistake with your parentheses: both OPEN and CLOSE need to be escaped. This works for me:
\(\u\)
-
AuthorPosts