Forum Replies Created
-
AuthorPosts
-
December 14, 2011 at 1:55 pm in reply to: How to export Find/Change queries without spending on additional plug-in? #61258
Theunis De Jong
MemberThat's in your application folder, and everything in there are part of ID's defaults.
Look in (user name)/Library/Preferences/Adobe InDesign/Version 6.0/en_US for your personal stuff.
Theunis De Jong
MemberIt's really hard to replace *all* occurrences of a particular swatch with another, what with the one-hundred-and-ten ways of using one. (I made that number up, but go ahead and count'em. Don't forget to include the gap color of a Continued Footnote rule.)
Deleting a swatch and replacing it with the new one *is* recommended, and your way of first duplicating the original is actually quite smart.
I guess I could write a script to provide an interface to this, but it would essentially do the same.
Theunis De Jong
MemberDo you mean you can't select this menu item? Is it gray (disabled)? Do the other functions in this menu work correctly?
Theunis De Jong
MemberOh blushes.
Did you notice it comes with a cool “Undo” option?
Theunis De Jong
MemberHi Cindy!
Well not that I know of but it's easy enough. Uh, for me it is, anyway.
//DESCRIPTION:Expand US State Abbreviations
if (app.version < '6')
doReplace();
else
app.doScript(doReplace, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, “Expand State Abbreviations”);function doReplace ()
{
var a;
var abbrevs = [ [ “Alabama”, AL ], [ “Alaska”, AK ], [ “American Samoa”,
AS ], [ “Arizona”, AZ ], [ “Arkansas”, AR ], [ “California”, CA
], [ “Colorado”, CO ], [ “Connecticut”, CT ], [ “Delaware”, DE ],
[ “District Of Columbia”, DC ], [ “Federated States Of Micronesia”,
FM ], [ “Florida”, FL ], [ “Georgia”, GA ], [ “Guam Gu”, GU ], [
“Hawaii”, HI ], [ “Idaho”, ID ], [ “Illinois”, IL ], [ “Indiana”,
IN ], [ “Iowa”, IA ], [ “Kansas”, KS ], [ “Kentucky”, KY ], [
“Louisiana”, LA ], [ “Maine”, ME ], [ “Marshall Islands”, MH ], [
“Maryland”, MD ], [ “Massachusetts”, MA ], [ “Michigan”, MI ], [
“Minnesota”, MN ], [ “Mississippi”, MS ], [ “Missouri”, MO ], [
“Montana”, MT ], [ “Nebraska”, NE ], [ “Nevada”, NV ], [ “New Hampshire”,
NH ], [ “New Jersey”, NJ ], [ “New Mexico”, NM ], [
“New York”, NY ], [ “North Carolina”, NC ], [ “North Dakota”, ND
], [ “Northern Mariana Islands”, MP ], [ “Ohio”, OH ], [ “Oklahoma”,
OK ], [ “Oregon”, OR ], [ “Palau”, PW ], [ “Pennsylvania”, PA ],
[ “Puerto Rico”, PR ], [ “Rhode Island”, RI ], [ “South Carolina”,
SC ], [ “South Dakota”, SD ], [ “Tennessee”, TN ], [ “Texas”, TX
], [ “Utah”, UT ], [ “Vermont”, VT ], [ “Virgin Islands”, VI ], [
“Virginia”, VA ], [ “Washington”, WA ], [ “West Virginia”, WV ], [
“Wisconsin”, WI ], [ “Wyoming”, WY ] ];app.findGrepPreferences = app.changeGrepPreferences = null;
for (a in abbrevs)
{
app.findGrepPreferences.findWhat = “”+abbrevs[a][1]+””;
app.changeGrepPreferences.changeTo = abbrevs[a][0];
app.activeDocument.changeGrep();
}
app.findGrepPreferences = app.changeGrepPreferences = null;
}December 2, 2011 at 6:38 pm in reply to: Script to change the language of all text on document #61214Theunis De Jong
MemberOkay so this is a tricky one. It appears you cannot easily use “find” with a language that is not in InDesign's internal list.
I've put up a query on Adobe's scripting forum for this, as I got everything working just fine — it's just this one little thing that stumps me!
December 2, 2011 at 2:26 pm in reply to: Script to change the language of all text on document #61212Theunis De Jong
MemberWell, David, you are correct in your observation of the behavior of these two scripts. The one above inquires InDesign about the list of supported languages, and the one you mention reads them from a document — which, annoyingly, may include text in a language that's actually not supported! So you can't use this script to remove the non-supported languages.
Oh, the conundrum.
I'll take a peek to see if it's possible to combine the two (and make the list of not-supported languages appear in a section of their own, in full ID Font List style. Also, if possible.)
Theunis De Jong
MemberSee https://help.adobe.com/en_US/in…..6d21a.html on how to reset your preferences.
Somehow it seems related to your documents, but you could try if it solves anything.
Barring that: well, I could write a Javascript that forcefully updates all page numbers in a book, but it seems a rather awkward thing to do by brute force if InDesign ought to do so all by itself. I haven't had this issue for a couple of .. years, perhaps? And usually, some manually fiddling got rid of the problem (i.e., manually switching Start Page Numbering At onf, save, re-open, toggle all “Automatic Book Numbering” options etc.).
December 1, 2011 at 2:58 am in reply to: Script to change the language of all text on document #61198Theunis De Jong
MemberSure, no problem. May Be Handy: if you have some text selected, it will be the initial language in the Find box.
Main();
function Main() {
if (app.documents.length == 0) {
alert(“Please open a document and try again.”);
exit();
}
langList = app.languagesWithVendors.everyItem().name.sort();
langList.splice (0,0, langList[langList.length-1]);
langList.pop();preselected = 0;
if (app.selection.length == 1 && app.selection[0].hasOwnProperty(“appliedLanguage”))
{
for (i=0; i<langList.length; i++)
{
if (langList[i] == app.selection[0].appliedLanguage.name)
{
preselected = i;
break;
}
}
}var langDialog = app.dialogs.add({name:”Find/Replace Languages”, canCancel:true});
with (langDialog)
{
with(dialogColumns.add())
{
with(dialogRows.add())
{
staticTexts.add({staticLabel:”&Find”, minWidth:40});
findDropDown = dropdowns.add ({stringList:langList, selectedIndex:preselected});
}
with(dialogRows.add())
{
staticTexts.add({staticLabel:”&Change”, minWidth:40});
chngDropDown = dropdowns.add ({stringList:langList, selectedIndex:0});
}
}
}if (langDialog.show() == true)
{
var doc = app.activeDocument;
app.findTextPreferences = app.changeTextPreferences = null;
app.findTextPreferences.appliedLanguage = langList[findDropDown.selectedIndex];
app.changeTextPreferences.appliedLanguage = langList[chngDropDown.selectedIndex];
doc.changeText();
app.findTextPreferences = app.changeTextPreferences = null;
}
}The convulated stuff right after retrieving the language list is because the languages don't come in their usual sorted order. It's easy to apply a sort, but then [No Language] ends up at the bottom. Rather than writing a custom sort function, I merely move the last item up to the top. I'm only assuming that'll actually always be [No Language].
Theunis De Jong
MemberI first tried to make an object box on one side, and was trying to figure out how to mirror it to the other side of the page. But I don't think that's going to work.
Draw two boxes. InDesign doesn't “do” live mirror effects (such as Illustrator does). Use the ruler and the control panel at the top plus some math to position them on the exact mirrored location.
What I'm going to try right now is to just draw a box the entire width of the page and use a swatch to color it grey. Then try to put another object on top of it the width of the content box that I want to create, and make that one white. Is that the best way to do this? I'm worried that it's going to increase my file size greatly.
Sure, that's another way. A box is simply four coordinates and a fill color, so it won't increase your PDF file size by much.
My second question is once I get this done (however I get it done) how do I apply it to all the pages in my document? Do I have to manually create it on all the pages?
That's what Master Pages are for.
Theunis De Jong
MemberNo, if you look in the Replace field of Find/Change you can see there is no option for that.
November 29, 2011 at 2:56 am in reply to: Copy GREP styles from one Paragraph Style to another #61181Theunis De Jong
Member1: When I define a GREP style as part of a Paragraph style it works fine
2: When I define another Paragraph style based on the first style, the GREP portion doesn't seem to be inherited as I would have expected.
That's a bit of a quizzler mate. The only way I can get to loose the “Based on” GREP style is by putting any GREP style in the new style before changing the Based On name. I have no trouble at all with my own flock of styles, all based upon a single great-grand-parent style, and I can add, remove, and edit GREP styles all along the way and see the changes propagate downwards.
It's possible to script it but it would need a cumbersome dialog (copy from what to what paragraph style) — I guess if the normal lines of inheritance don't work properly, it's easier to just copy and paste the expression.
Theunis De Jong
MemberI forgot all about the optional parameter for findText:
https://jongware.mit.edu/idcsjs…..l#findText
— you can set its one, and optional, parameter to “true” and it will return the found array in reverse order. So the 'reverse' wasn't necessary after all.
Oh well, it gave me a chance to tell about the pop command.
Theunis De Jong
MemberYou're welcome!
A small implementation footnote:
The findText method returns an array of found items in the actual order they are present in the document (albeit “per story”, that is, it processes all text frames in the 'first' story, then goes to the next one etc.).
The usual way of processing this list is a loop like this:
for (loopCounter = 0; loopCounter < list.length; loopCounter++)
.. process item
but I really like the combination of a 'while (list.length > 0)' and 'list.pop()' as it's slightly less typing. However, the 'pop' method works last-to-first, and although it's true this sometimes is what you need — when changing actual text it's virtually a requirement, because otherwise the found text array will be invalidated — in this case I thought it annoying “hyperlink #1” in the hyperlink panel appears at the very end of your text, and the last hyperlink in the list appears at the very start.
So I pasted the 'reverse' command at the end of 'findText', which simply reverse the array in memory, going from end to start. And then the first 'pop' pops off the very first hyperlink, processes it, and continues with the 2nd one, etc. etc.
Theunis De Jong
MemberHere you go.
app.findTextPreferences = null;
app.findTextPreferences.appliedCharacterStyle = app.activeDocument.characterStyles.item(“Product Code”);
sourcelist = app.activeDocument.findText().reverse();
while (sourcelist.length > 0)
{
url = sourcelist.pop();
app.activeDocument.hyperlinks.add(app.activeDocument.hyperlinkTextSources.add(url), app.activeDocument.hyperlinkURLDestinations.add(“www.”+url.contents+”.com”));
} -
AuthorPosts
