Forum Replies Created
-
AuthorPosts
-
April 2, 2019 at 5:36 am in reply to: Script to take selected frame (artwork @ 10%), open new document with 100% scale #115754
Jeremy 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.
April 1, 2019 at 4:02 am in reply to: Script to take selected frame (artwork @ 10%), open new document with 100% scale #115702Jeremy Howard
ParticipantThis could absolutely be done! What scripting language are you most familiar with?
Also, what OS are you running, OS X or Windows?
Jeremy Howard
ParticipantSituation like this are why I am such an ardent supporter of style sheets, fixing this rather strange issue would be a breeze with the proper style sheet configurations.
I am wondering, did you also upgrade your computer? If so, this could be a slight difference between versions of fonts between systems.
Jeremy Howard
ParticipantVinny, those are both wonderfully creative solutions to this problem. Nice work!
Your line of thinking got me thinking; another option would be to have two separate text frames, (one above the object and one below) and thread them. This would cause text to break around the object and would keep the spacing exact.
Jeremy Howard
ParticipantAh, I see… I don’t know of a way to fix that to be honest. I could do a bit of digging and let you know if I come up with anything.
In the meantime, consider creating two object styles to apply your wrap with. One for the top of page and one for mid page.
Jeremy Howard
ParticipantHere, I added some checks, this version checks that the selected item(s) is a text frame, will alert you if it finds an invalid file path within the selected frames and will fit placed images to the frame proportionally…
Enjoy!
//Begin Script//////////////////////////////////////////////////////
var mySelection = app.selection;
for(thisItem = 0; thisItem < mySelection.length; thisItem++){
var currentFrame = mySelection[thisItem];
if(currentFrame instanceof TextFrame){
var frameContents = currentFrame.paragraphs[0].contents;
var myImage = File(frameContents);
try{
currentFrame.place (myImage, false);
}catch(e){
alert(“Invalid file path!\r\rThe file \”” + frameContents + “\” could not be found. \rPlease check the file path and try again.” );
break;
}
currentFrame.fit(FitOptions.PROPORTIONALLY);
}
}
//End Script////////////////////////////////////////////////////////Jeremy Howard
ParticipantHey Julie, I just knocked together this little script. It’s super plain and doesn’t contain any error trapping but it should do the trick/give you a good starting point.
To use this script, select one or more frames that contain file paths as text and run it. The images will automatically be placed in each of the selected frames!
//Begin Script//////////////////////////////////////////////////////
var mySelection = app.selection;
for(thisItem = 0; thisItem < mySelection.length; thisItem++){
var currentItem = mySelection[thisItem];
var frameContents = currentItem.parentStory.contents;
var myImage = File(frameContents);
currentItem.place (myImage, false);
}
//End Script////////////////////////////////////////////////////////Jeremy Howard
ParticipantHello Stephanie, I am having a bit of trouble envisioning the method/scenario that you would be having trouble with this. Which method of text wrap are you using? (Wrap around bounding box, Wrap around object shape or Jump object).
Is the object with the wrap bumping all of the text in a frame down or is text flowing around the side(s) and then across the bottom?
Jeremy Howard
ParticipantTry wrapping the command string in quotes? (I really don’t know)
If you send me the script then I could take a look to see if I can help!
Jeremy Howard
ParticipantI am not super familiar with versions of InDesign prior to 5 but I know that since 5, the anchored object controls have been more or less the same. If you want the images to reflow and stick with a particular paragraph/set of paragraphs then I absolutely recommend using anchored objects. There are lots of tutorials out there but I have found that thoughtful experimentation with the anchored objects options is the quickest and surest way to learn.
If you want to jump-start your understanding and get an idea on where to begin then check out InDesign Magazine issue 117, it contains a great deal of info about anchored images/frames.
Jeremy Howard
ParticipantAh, David beat me to it, I was going to mention the numberpad limitation on the style sheet shortcuts =)
Note that you can create style sheet shortcuts using command/control + num, option/alt + num or command + option + num/control + alt + num. If I am setting up a complex template then I will often assign “command + num” shortcuts to paragraph styles, “option + num” shortcuts to character styles and “command + option + num” shortcuts to object styles.
Another piece of advice, to try to help keep your sanity intact: When attempting to make a character style that only changes one property (only the font, in your case) make sure that you don’t have any page items selected and make sure that you have “[None]” selected in your character styles panel before you click “create new character style”. If you have an existing character style selected when you create a new character style then the new character style will contain properties that were specified in the style you had selected.
Selecting “[None]” before creating a new style will give a completely clean style that has no properties set.
Jeremy Howard
ParticipantHey Masood,
The batch convert script that you are referring to will also work on all open documents. You don’t need to select a folder to batch for that script to work.
Jeremy Howard
ParticipantHey Bob,
Are you creating the table of contents using InDesign’s table of contents tool? If so,check your pdf export settings.
When you export the PDF, check the “Include” section of the “General” tab and be sure that “Hyperlinks” is checked. The TOC should now be linked!
If you’re not using InDesign’s TOC tool, start.
-
AuthorPosts
