Forum Replies Created
-
AuthorPosts
-
Theunis De Jong
MemberOkay, let's try this — please make sure to check the script very carefully after copying, because the forum software may attempt to prettify the code!
This script lets you select a single folder, then it goes over all .indd files in it, gathers your numbers, and finally lets you select an output file.
/* 1. What you want? */
var foundList = [];
var docFolder = Folder(Folder.myDocuments).selectDlg('Select a folder');if (docFolder != null)
{
/* 2. How much of'em? */
fileList = docFolder.getFiles(“*.indd”);for (f=0; f<fileList.length; f++)
{
/* 3. What you want with each? */
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
try {
doc = app.open (fileList[f]);
} catch (e)
{
foundList = foundList.concat ([fileList[f], “(Unable to open)”], '');
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
continue;
}
foundList = foundList.concat (getFoundList (doc));
doc.close(SaveOptions.NO);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
}
}/* 4. Where you want it? */
defaultFile = new File (Folder.myDocuments+”/numbers.csv”);
writeFile = defaultFile.saveDlg( 'Save report', File.fs == “Windows” ? “CSV file:*.csv;All files:*.*” : function(file) { return file instanceof Folder || (!(file.hidden) && file.name.match(/.csv$/i)); } );if (writeFile != null)
{
if (writeFile.open(“w”))
{
writeFile.encoding = “utf8”;
writeFile.write (foundList.join('r')+'r');
writeFile.close();
} else
{
alert (“Something went wrong attempting to save!”);
}
}function getFoundList (someDoc)
{
var i, thisDocList;/* Where you at? */
var documentName = someDoc.name;/* What you want? */
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = “\d{3}-\d{3}-\d{3}(?!\d)”;
thisDocList = someDoc.findGrep();if (thisDocList.length == 0)
return [];for (i=0; i<thisDocList.length; i++)
thisDocList[i] = thisDocList[i].contents;/* Where you want it? */
return [ documentName ].concat(thisDocList);
}Theunis De Jong
MemberAmy, the simplest solution is to type two \'s where you want to see one . (And so to get those two \'s I had to actually type “”.)
I see you edited your 2nd post — if you edit a post where you inserted double backslashes to get single ones, you will see that they are actually stored online as single backslashes. It's just the input system that 'needs' this. So if you edit a post, make sure to scan for any 'slashes and double them up again.
Theunis De Jong
MemberGREP is indeed greedy, but that's not the issue here. It's only greedy when you use potentially “unlimited match” operators + and *. For your phone numbers it still works as intended, finding three sets of three digits — but your phone number also contains a fourth. Note that this fourth one is not 'matched', i.e., it's not included in the selection. Then again, matching the partial phone number is also no good.
So in this case you want to find 3 sets of 3 digits not followed by a fourth digit. That can be expressed as such:
d{3}-d{3}-d{3}(?!d)
As for the rest of your script … it's really fairly easy, honestly — I just don't seem to find the time to put something together, test it, and post it here :( But in short: if you are able to use “find” to match the exact stuff you need, you can loop over the resulting 'found items' array and write this text into a file.
One note: this method will give you a list of just those numbers. Is that really all you need — the numbers, nothing more?
Theunis De Jong
MemberAs for #2., Word internally converts a lot of bitmap files to the PNG format, which allows transparency. InDesign does not check if it's actually used (it would need to check each separate pixel for that), so when it encounters a PNG file that declares “I might have some transparent pixels” it assumes it has.
Transparent items force InDesign to use a slower-but-more-accurate drawing model. Unfortunately, this is also reflected in text rendering, which seems to be a bit bolder than usual. However, usually it's not visible in print. (Caveat: this actually depends on the stacking order of text and transparent items.)
As you noted, the effect disappears when you “flatten” the images (I assume you do this with Photoshop?), and thus remove the transparency. That is indeed a solution.
Another would be to force InDesign to flatten out transparency on exporting your PDF, and there are various ways of doing this. Export using one of the “pre-press” PDF-X presets (I always forget which one 'cause I do the next thing, which is…) or use a Very Old PDF version such as 1.4, which doesn't support transparency natively. You can also tinker with the transparecy settings inside InDesign itself.
In general I avoid the problem in its entirety by never using natively embedded Word objects. I convert everything to either a bitmap file on its own, or to a ready-to-be-placed PDF. Little more work, way better control over quality.
August 13, 2012 at 2:30 am in reply to: It's clear as mud on how to create different headers representing each Chapter. Help. #62874Theunis De Jong
MemberI'm totally and completely lost.
The underlying problem, d, seems to be you started working with an extremely professional — and thus complicated — piece of software, apparently unhindered by any former knowledge. Compare it to purchasing AutoCAD and then expecting to be able to design a nuclear power plant right from the start.
You are correct in your assesement that I cannot recall what's it like to know absolutely nothing, because I was never there. I grew up with word processors such as WordStar and WordPerfect, made a smooth transition to Word, PageMaker, and the odd stint of Quark XPress, and was happy to leave that all behind me faced with the awesome array of capabilities of InDesign. Still — the company I work for firmly believes in educating people, both interns and clients, and there is no level too low for us to teach something.
… If my steps are still too big, buy larger boots.
Let's tackle today's problems, shall we.
I followed all the directions (even though I had no idea whether to choose Character or Paragraph Style. I chose Character for the heck of it)
Why “for the heck of it”? That indicates you have no idea why you actually have two choices here.
“1. If your content is not already formatted, create and apply the paragraph style or character style for the text you want to appear in the header (such as a title or heading style).”
Your headers need to be marked with either a paragraph style or with a character style. Possibly both (which is unnecessary), but “I'm not using styles” is not an option here, would be the main point of this bullet point. Since I cannot look over your shoulder, I don't know if you are using styles, and if so, if your chapter headings are formatted using paragraph or character styles. Let's amuse ourselves, and assume you have done it right and used a paragraph style.
First, give this variable a good descriptive name, the default “Variable 1” is kinda opaque; something like 'chapter' springs into mind.
The next step is, still quite obvious, that you have to tell InDesign what style to choose. The other options (Use, Case, Punctuation) are For Other Uses and may best left at their default settings.
What have you got at this point? Well, nothing yet. The variable is “defined” but, just like a paragraph or character style, it doesn't “do” anything until you actually use it somewhere. So it's on to the next hurdle: the bewildering list of steps to make sure the variable “does” something.
1) Add what text?? If I put the title of Chapter One, that would put that title on all 384 pages, right? I've already added the page numbers before this. [..]
Any text you want. Hey, it's your Master Page, and you are its sole Master and Commander! If you want to have the text “doodlebugs rule” on each page, well, this would be the place & time to insert it. The title of Chapter One, well, sure, if you want to have that appear on each page — but obviously you do not, so why mention it?
[..] I have no idea how to add a variable.
Hm. It doesn't get mentioned on the Help page I pointed you to. Okay, you might recall how you got to the “Define Variables” dialog: Type menu -> Text Variables -> Define .. The other choice in that menu is “Insert Variable”, and it's important to note that a text variable is a sort of text; you can only insert it into a text frame. If you are not inside a text frame, the command is simply grayed out. If you do not have a text frame, draw one (preferably on the location where you want your header to appear).
Once inserted, apply any text formatting to the variable code. Remember, this is still a Master Page so the only text you will see is the variable name; but on “live” pages, the picked up paragraph style text will appear in the formatting that has been applied to the variable code.
2) How do I “Apply the master page”?
The Usual Way, through the Pages panel menu. See the Online Help if in doubt.
3) Additional Master pages??
It's unclear to me what is unclear to you here. Yes, you can create additional Master pages (lots and lots of them)? No, you don't Need To if you don't Want To? This point #3 is only there if you want more than a single style of header and/or footer. In particular, it has nothing to do with you having several chapters — the Text Variable is going to take care of that, as per its designated purpose.
Give it a shot and call me back in the morning, but make sure to have done your homework first.
August 12, 2012 at 3:59 pm in reply to: David, viewing your numbering video, but I don't have "A Main page" #62866Theunis De Jong
MemberSeems you inadvertently set a lot of “start new section HERE” on your pages. Look in the pages panel for the tell-tale small black triangle at the top of a page. The very first page always has one, because the start of a document is the start of a new section by definition. All others have been set manually, by you that is.
Call up the Page Numbering (etc.) dialog for these pages (and one at a time) and deselect “Start new section”. In addition, it also seemed earlier you went on a clicking spree inside this dialog, hence you got all those different page numbering formats. Do Not Click On Random Items And Hope It Get Things Working. This method hardly ever works in InDesign.
(A co-worker of mine went to a similar phase, and accidentally selected “Close” for the document he had been working on for several hours — without saving in between. InDesign prompted him with the familiar “Save before closing? [Yes] [No] [Cancel]”. He panicked and thought “No” was the safest answer. Laughs all around when ID threw away all of his work. Well, not from him, naturally.)
August 12, 2012 at 3:50 pm in reply to: It's clear as mud on how to create different headers representing each Chapter. Help. #62865Theunis De Jong
MemberThe text for a section marker is set in “Page Numbering and Sections” in the pages panel. The actual section marker itself is a text object and should be inserted in a text frame. Seems you mixed up these two.
See (again) the online help, first hit on searching for “section marker” … https://help.adobe.com/en_US/in…..7111a.html
That said, using section markers for automatic headers or footers is so 2009, i.e., pre-CS4. Look up “text variables” in the online help for a far better way.
August 12, 2012 at 7:42 am in reply to: Have viewed hyphen videos–can I fix ONE poorly-hyphenated word? #62856Theunis De Jong
Memberhttps://help.adobe.com/en_US/in…..6d98a.html — the top hit when searching the Online Help for “hyphenation”.
The section you should read is “Adjust hyphenation manually” (well, obviously you should read the entire page as well…)
August 6, 2012 at 1:39 am in reply to: Help me understand how to create this particular Style…. #62769Theunis De Jong
MemberYou need to read up on the difference between Paragraph and Character styles. This
.. am I forced to use a Character Style for the word (bolded, left, space after) and a Paragraph Style for the description?
is not going to work. You clearly have two different paragraphs — InDesign considers everything that ends with a return a paragraph, even if it seems to you it's 'just a single bold word'. And a paragraph needs a paragraph style. Character styles do not allow “left, space after” settings.
As Gert says, create two paragraph styles (although I would strongly suggest a more descriptive name than “bold” ;) ) and use the “Next Paragraph Style” function to assign them quickly.
Theunis De Jong
Member1. Set “Normal” in the Find formatting field, under “Character formatting”. This will find occurrences where the superscript attribute is not applied.
2. .. except, of course, when the 'superscript' is actually built in the character design. Highly annoying; some fonts have these characters “pre-superscripted”, some don't. So at times you get them doubly superscripted, an invisible little speck; but with another font, without a superscript you get the raw full blown capital-height version.
I wish someone had written down a couple of rules for a consistent design of these characters.
Theunis De Jong
MemberThe regular way of 'escaping' GREP characters and to have them processed as “literal” character is to precede them with a backslash . So * will find a literal asterisk, . a literal full stop, and \ one single backslash.
Your asterisk-plus-digits search would be this:
*d+
July 13, 2012 at 4:09 pm in reply to: Change ALL CAPS format to REAL uppercase letters – with GREP Search? #62604Theunis De Jong
MemberFind “Apple” and change to “APPLE”…
(Some dialects of GREP have a “change case” option, but InDesign does not.)
Theunis De Jong
Member.. either of these words “is” or “are” but not to include those words in that formatting ..
Exactly there is where a little Looking Ahead can help you! A Lookahead is a text string that will be found but not included in the match itself, and it looks like this: any(?= text). This will find “any text” but only match the phrase before the lookahead: the word “any”. If you use this in a Find command, you will see only the word “any” will be selected, and if you use it in a GREP style, your character style will only be applied to this.
Try this:
^.+(?= (is|are))
— note the single space inside the Lookahead, so it won't match “this” (or “thare”, for that matter).
July 10, 2012 at 10:32 am in reply to: Placing Images to specific place on document.. Javascript Reference? #62579Theunis De Jong
MemberAh, nothin' like tootin' your own horn

To place a new file on an exact location, you must do two things. First, place the new image (https://jongware.mit.edu/idcs5&…..html#place). The return object of “place” is an array, and its first item (#0 for Javascript) will be a handle to the image. However, for the next step, you need to move its frame, just like in the interface itself.
Try this (warning: typed on my iPad, so from memory):
img = app.activeDocument.place(new File(“yourfilename”));
imgFrame = img[0].parent;
imgFrame.move([“1in”, 1in];
This will place rhe image and then move it to 1″ off the left top of your page (actually, relative to the ruler origin, whereever that may be — but “top left” is a fairly good bet).
More information: Adobe's site has a Beginner's Guide for Javascript under the heading “Scripting resources”. Then there is my own Introduction to JS for ID: https://creativepro.com/jav…..ginner.php
and on the MIT site I referred to above expanded and improved versions of the built-in Javascript Reference for every InDesign version since CS3 or so. All of that ought to keep you occupied for a while!
Theunis De Jong
MemberSo you don't want to search for the same text again? Sorry, I thought it was just your three dots.
Scripts are horrible for “interactive” stuff — doing something, awaiting user input in the background, then continuing. I can't visualise something that would work better than the normal find & change.
-
AuthorPosts
