Forum Replies Created
-
AuthorPosts
-
Jeremy Howard
ParticipantHmmm… I honestly don’t know. What an incredibly frustrating bug! If I were in your shoes, my next action would be to reinstall InDesign all together. I know it’s time consuming but then again, so is dealing with this issue while you are trying to hit deadlines!
I wish I could be more help
Jeremy Howard
ParticipantHave you tried resetting your InDesign preferences? Launch InDesign and immediately hold the control+command+shift+option keys. A dialog will appear asking you if you are sure that you want to reset all of your preferences, click “Yes” and see if that helps.
Jeremy Howard
ParticipantAh yes, to make my solution work, you would need to turn multiline on with — (?m)
Making the complete GREP string:
(?m).+,(?=.+,.+$)\K.+
Jeremy Howard
ParticipantIt just occurred to me that the string that I provided is matching and formatting the comma before “Any Town”. A slight tweak to the GREP fixes this:
.+,(?=.+,.+$)\K.+
Jeremy Howard
ParticipantHello Amanda,
The way to accomplish this would be to utilize “\K”.
Here is the GREP I used to make it work when testing:
.+(?=,.+,.+$)\K.+
The first bit — .+ matches all characters that fall before the positive lookahead
The positive look ahead — (?=,.+,.+$) matches to a comma, 1 or more characters, another comma, 1 or more characters and then the end of the paragraph.
Now for the really nifty part. The “\K” is used to ignore everything that has been matched by the GREP before it. That means that all of the matched characters from the first part of the GREP string — .+(?=,.+,.+$) are essentially being used to tell the second part — .+ (match 1 or more characters) where to begin.
So the first part of the GREP string (the part before the “\K” actually matches all of the text in your paragraph up until the second to last comma, then we use \K to tell the GREP to apply the style to every character after that match.
April 7, 2019 at 1:15 pm in reply to: Find and Replace is not working for Forced New Line Character #115913Jeremy Howard
ParticipantJust off the top of my head, they rather than ^n and see if that works
Jeremy Howard
ParticipantAh, but that is thinking more complicated than most (at least from a readability and troubleshooting perspective).
I broke out the pieces of the script in order to simplify it, people new to scripting will find the drawn out version easier to read and will almost certainly get more out of it.
Condensed scripting != Simple scripting
:)
Jeremy Howard
ParticipantOh, I see! So, what you will want to do is this:
var mySelectedCells = app.selection[0];
var myTargetRows = mySelectedCells.rows;for(x = 0; x < myTargetRows.length; x++){
myTargetRows[x].select(SelectionOptions.ADD_TO);
}Jeremy Howard
ParticipantHey Michel,
You can access the rows of the selected cells this way:
var mySelection = app.selection[0].rows;
Cheers!
Jeremy Howard
ParticipantHey Kal,
Thanks for the response! I actually ended up figuring it out. Oddly enough, InDesign saw my selection as “[object Cell]” – even though I had two entire rows selected! Once I got the “[0]” added to the end of “app.selection” (like you indicated in your reply) I was able to get the rows just fine. The reason I was stuck earlier is because it never occurred to me to look for “rows” inside of an “[object Cell]”…
Here is what I ended up doing:
var myRows = app.activeDocument.selection[0].rows;
Thanks again!
April 2, 2019 at 6:11 am in reply to: Script to take selected frame (artwork @ 10%), open new document with 100% scale #115756Jeremy Howard
ParticipantHere is a better version that copies the selected image to a new document, dynamically sizes it to 100%, centers it on the page and exports the page to a PDF that is named using the original image name.
// Begin Script ////////////////////////////////////////////////////////////////////////////////////
//set selection as variable
var thisItem = app.selection[0];//create new document
var myNewDocument = app.documents.add();//duplicate selected item to new document
var myDuplicatedItem = thisItem.duplicate(myNewDocument.pages.item(-1));//get image within the frame
var myLinkedItem = myDuplicatedItem.pageItems[0];
//get name of the linked image
var myLinkName = myLinkedItem.itemLink.name;//strip extension from linked image name
var myLinkName = myLinkName.split(“.”)[0];//find the horizontal and vertical scale integers
var myHscale = 100 / myLinkedItem.horizontalScale;
var myVscale = 100 / myLinkedItem.verticalScale;//Scale the image around its center point
var myScaleMatrix = app.transformationMatrices.add();
myScaleMatrix = myScaleMatrix.scaleMatrix(myHscale, myVscale);
myLinkedItem.transform(CoordinateSpaces.PASTEBOARD_COORDINATES, AnchorPoint.centerAnchor, myScaleMatrix);//fit frame to content
myDuplicatedItem.fit(FitOptions.frameToContent);//get width of the full-sized item
var dupedItemWidth = myDuplicatedItem.geometricBounds[3] – myDuplicatedItem.geometricBounds[1];
//get height of the full-sized item
var dupedItemHeight = myDuplicatedItem.geometricBounds[2] – myDuplicatedItem.geometricBounds[0];//get the x coords we need to center the item on the page
var xCoordsCalc = (myNewDocument.documentPreferences.pageWidth – dupedItemWidth) / 2;
//get the y coords we need to center the item on the page
var yCoordsCalc = (myNewDocument.documentPreferences.pageHeight – dupedItemHeight) / 2;//set frame bounds in order to center the frame on the page
myDuplicatedItem.geometricBounds = [yCoordsCalc, xCoordsCalc, (yCoordsCalc + dupedItemHeight), (xCoordsCalc + dupedItemWidth)];//move the image to fit into the centered frame
myDuplicatedItem.fit(FitOptions.contentToFrame);//Set Name of exported pdf to match the name of the linked image
var myFile = File(“/Users/admin/Desktop/” + myLinkName + “.pdf”);//export the pdf
myNewDocument.exportFile(ExportFormat.PDF_TYPE, myFile, false, “High Quality Print”);// End Script ////////////////////////////////////////////////////////////////////////////////////
April 2, 2019 at 5:36 am in reply to: Script to take selected frame (artwork @ 10%), open new document with 100% scale #115754Jeremy Howard
ParticipantHey there,
Try this script out, I think that it accomplishes what you are trying to accomplish. It scales an image dynamically to ensure that it gets scaled up to 100% in the new document (rather than scaling based on the static 1000%).
//////////////////////////////////////////////////////////////////////////////////////
//set selection as variable
var thisItem = app.selection[0];//create new document
var myNewDocument = app.documents.add();//duplicate selected item to new document
var myDuplicatedItem = thisItem.duplicate(myNewDocument.pages.item(-1));//get image within the frame
var myLinkedItem = myDuplicatedItem.pageItems[0];//find the horizontal and vertical scale integers
var myHscale = 100 / myLinkedItem.horizontalScale;
var myVscale = 100 / myLinkedItem.verticalScale;//Scale the image around its center point
var myScaleMatrix = app.transformationMatrices.add();
myScaleMatrix = myScaleMatrix.scaleMatrix(myHscale, myVscale);
myLinkedItem.transform(CoordinateSpaces.PASTEBOARD_COORDINATES, AnchorPoint.centerAnchor, myScaleMatrix);//fit frame to content
myDuplicatedItem.fit(FitOptions.frameToContent);//////////////////////////////////////////////////////////////////////////////////////
Jeremy Howard
ParticipantI’m assuming that when you say Adobe, you mean Adobe Acrobat? If I had to guess about your images I would venture a guess that you may be missing a link.
Open InDesign and open the Links panel. Check to see if any of the links have a yellow exclamation point or red “x” next to them.
-
AuthorPosts
