Forum Replies Created
-
AuthorPosts
-
September 29, 2021 at 6:49 am in reply to: Windows activates “last application” after running a script in InDesign #14347685
Tamás Nagy
ParticipantMaybe this annoying thing happens only if a Dialog was used in the script to get the neccessary parameters. But earlier it didn’t mean a problem.
May 26, 2020 at 9:15 am in reply to: Why InDesign generates heavy internet traffic at startup #125226Tamás Nagy
ParticipantHi David,
thank you for your tips but as far as I see this problem appears only in the version CC2019. I use versions from 2018 to 2020 simultaneously because of historical reasons but only CC2019 produces this behaviour. So I think the solution is to quit using CC2019 forever. :)
Btw. I turned off any welcome screens at the very beginning when it appeared, so it mustn’t be the problerm, I think.
All the best,
TamásMay 26, 2020 at 3:01 am in reply to: Why InDesign generates heavy internet traffic at startup #125287Tamás Nagy
ParticipantSorry, Marc. :)
Because of this full-bandwidth download, even this above post took about 20 seconds to go through. It makes it impossible to work on the net for 5-10 minutes each time.May 26, 2020 at 2:57 am in reply to: Why InDesign generates heavy internet traffic at startup #125274Tamás Nagy
ParticipantThanks Mark, I tried it: nothing special happened, I could use InDesign as usual.
But at the minute I plugged the Ethernet cable back InDesign started download at full bandwidth again.
Today I started InDesign twice, the same thing happened both times.Tamás Nagy
ParticipantI didn’t mention what the original task was. I have to copy the exact text content of some paragraphs from a book into an InDesign table, then export this table into an RTF file for further processing by other experts. The book is 620 pages long and there are an average 5-10 such paragraphs on a page so I decided to do it by a script. The problem is that some characters that were borrowed from a font named Zapf Dingbat didn’t go through.
Later I modified the above script to the following:
myParagraph.duplicate( bla…bla);
and then at the destination I removed all unnecessary formattig from it. This way those characters didn’t disappear. But after exporting I had to realize that although in InDesign I saw those characters, in Word they disappeared again. This time they were simple Arial glyphs, so their Dingbat past was gone.
The book was originally typeset in London, and as I investigated the whole, I saw they used 3 diffferent Zaph Dingbats fonts throughout the book:
ZapfDingbats PostScript (unknown)
ZapfDingbatsITC TrueType (unknown)
ZapfDingbatsStd OpenType (Adobe_OT_Library)I don’t know where they got these fonts, and why they used 3 different instances for the same purpose but I may not change it. I think all 3 are some illegal copy or modified somehow. But why they didn’t work after the text has already been formatted to Arial?
Tamás Nagy
ParticipantHi Brett,
I wouldn’t bring InDesign’s text/grep search into it, I would simply go through all the paragraphs, using a status variable that stores which sex was found last. This status may directly point at the necessary character style. If the text you have to process is surely consists of records you showed above than a quite simple for loop will do the job. I mean if each and every record surely contains a sex field with exactly “GIRL” or “BOY” in it and anoter field that starts with “Photo:” and right after it comes the Name field then here’s a code yo can try. You should replace “…”s with the actual character style names.
—————————————————
var myD=app.activeDocument;
var myBoystyle = myD.characterStyles.itemByName(“…”);
var myGirlstyle = myD.characterStyles.itemByName(“…”);
var myParags = myD.stories.everyItem().paragraphs.everyItem().getElements();
var myStyle, nextP;for ( var p=0, plen=myParag.length; p<plen; p++ ) {
if (myParags[p].contents==”BOY”) myStyle = myBoystyle;
if (myParags[p].contents==”GIRL”) myStyle = myGirlstyle;nextP = myParags[p+1];
// if there does exist a next paragraph AND this is the Photo field AND myStyle is alread defined…
if ( nextP.isValid && nextP.contents.slice(0,6)==”Photo:” && myStyle ) nextP.appliedCharacterStyle = myStyle;};
—————————————————
I think it should work. But this code goes through ALL stories in the active document and it doesn’t recognise the story boundaries, so if “BOY” was found in a given story and “Photo:” in the next, it won’t make the difference, it will format the next paragraph of the second story. If you don’t like it, you have to make a double for cycle:
—————————————————
var myD=app.activeDocument;
var myBoystyle = myD.characterStyles.itemByName(“…”);
var myGirlstyle = myD.characterStyles.itemByName(“…”);
var myStyle, nextP, myParags;var myStories=myD.stories;
for ( var s=0, slen=myStroies.length; s<slen; s++ ) {
myParags=myStories[s].paragraphs;
myStyle=null;for ( var p=0, plen=myParags.length; p<plen; p++) {
if (myParags[p].contents==”BOY”) myStyle = myBoystyle;
if (myParags[p].contents==”GIRL”) myStyle = myGirlstyle;nextP = myParags[p+1];
if ( nextP.isValid && nextP.contents.slice(0,6)==”Photo:” && myStyle ) nextP.appliedCharacterStyle = myStyle;
}; // end for p
}; // end for s
—————————————————
Notice: applying character styles on whole paragraphs is not too elegant, so I suggest to use paragraph styles instead.
I hope, it helps, best,
TamásTamás Nagy
ParticipantSorry for the off but why can’t I place my posts here?
I posted yesterda, I posted today but after clicking Submit, the post just diappeared.Tamás Nagy
ParticipantThanks, Brian,
maybe finally I’ll have to replace it firts with a GREP change but I’m afraid this stuation will arise later again and again, maybe with other characters, or other fonts, so first I would try to defeat the bug altogether, without altering the original documents.
My job is to collect certain paragraphs from a book into an RTF table that will be later processed by experts and finally returned into the original document. This time the book is 620 pages long and there are some 5-10 relevant paragraphs on a single page so it certainly needs a script. And it is just one book (although it is definitely within the biggest ones) of the many.
First I tried to store the text content of the original paragraph into a string (myString=origParagraph.contents), then in another document I gave this content to an unformatted (plain Arial), yet empty paragraph in a table cell (myParagraph.contents=myString). This method didn’t work, since this mystical character disappeared somehow: the string still contained it, the cell-paragraph not.
Later I tried something else. I simply copied the original paragraph into the cell (orgigParagraph.duplicate(LocationOptions.AT_BEGINNING, myCell). This way I saw some character in the right place, although it didn’t look the same. Juppie, let’s go on, export the table from InDesign into an RTF file! Then in Word I checked the result. And the character disappeared again.
To Theunis:
I’m not sure but I think that if any character (with an unicode index, say 276F) isn’t implemented in a font then Indesign usually replaces it with some other character from the font, maybe the one named “notdef”, of course only if this character does exist. I have’n tested what happens when the applied font misses this special character as well. First I wrote that the character in question has no Unicode index: I checked it in a font editor, but in InDesign, on the Glyphs palette some index was assigned to it, anyway. I don’t think it is normal that any character is just left out. And it is probably (or at least should be) independent of the font used. Isn’t it?Tamás
Ps: Yesterday two of my posts didn’t appear here at all after clicking on Submit. What could I do wrong? :D
Tamás Nagy
ParticipantHi Theunis,
I’m sure that this font is NOT the original one (btw. which is the original, the simple or the ITC version, the regular or the medium style…) but we are fixed to it since our client uses this one, they have no other variation. I think this problem is only an indicator that shows us that something is not perfectly round in InDesign.
Or maybe this is an unusable pirate-copy of that font and this is what causes all our problems. I don’t know.
Tamás
Tamás Nagy
ParticipantSorry for the double post, I pressed Submit button twice because seemingly nothing happened after the first click.
I searched the home folder of Indesign for the word “Minion” and found the file Predef_huHU.iddx that contained almost the same info you showed in the article of Indesign Secrets:
<RootParagraphStyleGroup>
<ParagraphStyle Self=”ParagraphStyle/$ID/[No paragraph style]” Name=”$ID/[No paragraph style]” FontStyle=”Regular” PointSize=”12″ KerningMethod=”$ID/Metrics” … [bla-bla] …
<Properties>
<AppliedFont type=”string”>Minion Pro</AppliedFont>It looks very much like that deep default of “No paragraph style”, doesn’t it? :)
There are such “Predef” files for each language, and there is also a file named simply Predef.iddx too.Maybe some time I will try to edit this file, but I’m a bit afraid of doing so. So if I don’t check in for a long time, tell my mom I love her! :)
Tamás Nagy
ParticipantThank you David, it was a very interesting tour into the Abyss. :)
So this way we can change the default font of an existing document. I think I will make good use of this knowledge.How do you think: is there a way to somehow change the same thing for all new documents?
I mean… is it possible that Indesign gets this 12 pt Minion font thing from another editable file?
An even deeper default…Tamás Nagy
ParticipantThank you David, it was a very interesting tour into the Abyss. :)
So this way we can change the default font of an existing document. I think I will make good use of this knowledge.How do you think: is there a way to somehow change the same thing for all new documents?
I mean… is it possible that Indesign gets this 12 pt Minion font thing from another editable file?
An even deeper default…Tamás Nagy
ParticipantHi again,
I’ve got an e-mail that said Lasse answered my question. But as I see there are no new answers here. Lasse’s post that was mentioned in the mail doesn’t solve my problem. It is a a great script but it still breaks text threads and ONLY this was my problem, not simply duplicating those pages.
I’m still seeking the solution if it exists at all. When I drag the spreads from one document into another by hand, all threads remain in place. The same action done from script works differently: it breaks all interspread threads.
Tamás
Tamás Nagy
ParticipantHmm… almost.
Tamás Nagy
ParticipantAnyway, here’s the translated script, use it, if you wish! :)
I will try to put the whole between ‘code’ tags, I hope it will work. If not, the tag is of course not part of the script. :D
var myInputfiles=[];
var myDoc, myStyleDoc;var myInitPath="~/Desktop/";
if (File.fs == "Windows") myInitPath="C:/";myGetStyleFile();
myGetfolderfiles();for (var i=0; i<myInputfiles.length; i++) {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
myDoc=app.open(myInputfiles[i],true,OpenOptions.OPEN_ORIGINAL);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
myDoc.importStyles(ImportFormat.TEXT_STYLES_FORMAT,myStyleDoc,GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
myDoc.close(SaveOptions.YES);
};function myGetfolderfiles(){
var myPath=new File(myInitPath);
myInputfiles=myPath.openDlg("Select all documents to refresh text styles in!",undefined,true);
if (myInputfiles==null) {alert("You didn't choose any docs, script terminates.","Error"); exit() };
};function myGetStyleFile(){
var myPath=new File(myInitPath);
myStyleDoc=myPath.openDlg("Select the document to be the source of text styles!",undefined,false);
if (myStyleDoc==null) {alert("You didn't choose a source doc, script terminates.","Error"); exit() };
};
-
AuthorPosts
