Forum Replies Created
-
AuthorPosts
-
Peter KahrelParticipantA. — This does doesn’t work in InDesign. Several feature requests have been submitted without much effect (please add your own).
One workaround, if the font you use has All Caps, is to look for ^ and apply allcaps.
The other workaround is a script, which can be very simple in principle:
app.findGrepPreferences = null; app.findGrepPreferences.findWhat = '^l'; found = app.selection[0].findGrep(); for (i = 0; i < found.length; i++) { found[i].contents = found[i].contents.toUpperCase(); }This targets the current selection. To target the document, replace app.selection[0] with app.activeDocument in line 3.
Peter KahrelParticipantLook for \$$
which stands for ‘Dollar symbol at the end of a line’.\$ matches the Dollar symbol, the following $ stands for ‘end of the line/paragraph’.
Peter
Peter KahrelParticipantBart,
I see the problem. What you find is in an anchor, so the script should do the sidedness test a bit differently.
But for what you want to achieve you don’t need a script at all: in the object-style window, in the Anchored Object Options panel, there’s a checkbox ‘Relative to spine’. Check that box and all your anchored v_margin frames will appear on the left-hand side of the main text on left-hand pages and on the right-hand side of the main text on right-hand pages.
Hartelijke groet,
Peter
Peter KahrelParticipantBill, B. Eenkhoorn — the script clearly runs into a situation that I’m unaware of. Can you post your documents so that I can have a look?
Peter KahrelParticipantI’ve no idea what goes wrong at your end. Works fine here with a variety of texts. What does your text look like, and what are you looking for?
Peter KahrelParticipantHere’s a wrapper to deal with books. Make sure there’s an open book, then run the script. The script opens, processes, and closes the book documents one by one.
(Hope you don’t feel I’ve hijacked your script, Keith.)
(function () { function removeBackgrounds (myDoc) { var myRectangleArray = myDoc.rectangles.everyItem().getElements(); for (var j = myRectangleArray.length-1; j >= 0; j--) { var myItem = myRectangleArray[j]; if ((myItem.graphics.length > 0 ) || (myItem.images.length > 0)) { myItem.fillColor = myDoc.swatches.item("None"); } } } var chapters = app.activeBook.bookContents.everyItem().getElements(); for (var i = 0; i < chapters.length; i++){ app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract; app.open (chapters[i].fullName); app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll; removeBackgrounds (app.activeDocument); app.activeDocument.close (SaveOptions.YES); } }());
Peter KahrelParticipantIt was and it wasn’t the space between the – and the 1: the forum software replaced [space]-[space] to [space]en-rule[space].
To run a script against all book documents, you could use the method described here:
https://forums.adobe.com/thread/2069523
See the first post by Vamitul.
Peter KahrelParticipantThere was another instance where the forum software tried to be ‘clever’. Change the curly quotes at None to straight quotes.
Peter KahrelParticipantPaul,
The forum software played a trick on Keith’s script. In this line:
for (var j = myRectangleArray.length ā 1; j >= 0; jā) {
the two minuses in
j--were replaced by an en-rule. Line 3 should befor (var j = myRectangleArray.length ā 1; j >= 0; j--) {Peter
Peter KahrelParticipantHere is a general template for targeting left- or right-hand pages. This particular example underlines numbers on left-hand pages. Change
LEFT_HANDtoRIGHT_HANDto target rectos. Make other changes as needed in lines 4 and 9.(function () { app.findGrepPreferences = null; app.findGrepPreferences.findWhat = 'd+'; var found = app.activeDocument.findGrep(); for (var i = found.length-1; i >= 0; i--) { if (found[i].parentTextFrames.length > 0 && found[i].parentTextFrames[0].parentPage.side === PageSideOptions.LEFT_HAND) { // i.e. not overset and on a recto // Do something, e.g. found[i].underline = true; } } }());Peter
January 26, 2016 at 10:38 am in reply to: Turn on Autosizing Options in Object Style created/modified by java script #81126
Peter KahrelParticipantoStyle.enableTextFrameAutoSizingOptions = true; oStyle.textFramePreferences.autoSizingType = AutoSizingTypeEnum.HEIGHT_ONLY;
You should learn how to use the object-model viewer, either the one built into the ESTK or one of the object-model viewers available on the web.
Peter
January 24, 2016 at 4:45 am in reply to: Save Indesign File with Specific Name in Specific Location – JS #81046
Peter KahrelParticipantMarcin,
Folder.selectDialog();
returns a Folder object, not a string.
P.
Peter KahrelParticipantThanks, Keith. I’d forgotten that you need to click the handles, not just the frames.
On text frames, FitOptions.FRAME_TO_CONTENT fits the frame vertically only, just like when you select that option in the interface (or press Ctrl+Alt+C or its Mac equivalent). Double-clicking the left- or right-hand handle fits the frame horizontally, but often breaks lines on its own accord, which is not what you want.
P.
January 23, 2016 at 1:22 pm in reply to: Save Indesign File with Specific Name in Specific Location – JS #81039
Peter KahrelParticipantIf you plan to do any file handling, do read the chapter ‘File system access’ in the JavaScript Tools Guide. Start the ESTK, go to the Help menu, click ‘JaveScripts Tools Guide CC’.
Peter
January 23, 2016 at 1:19 pm in reply to: Save Indesign File with Specific Name in Specific Location – JS #81038
Peter KahrelParticipantmyDocument.save (File('ZZZZ/yyyy.indd'));P.
-
AuthorPosts
