Copy link to clipboard
Copied
Dear Community,
I'm hoping there's a solution to this one within Indesign. I have multiple different sized rectangle picture boxes (objects) on a page and need to resize them all at the same time by adding 6 mm to the height and 6 mm to the width of each.
Essentially I have a page of many picture boxes of different sizes which I can add crop marks via the script, offset 3 mm from the object. I then need to add 3 mm around all images. And then I can fit content to frame all at the same time. This will then quickly give me images on the page with crop marks and bleed for multiple sized objects on a page ready for printing on large boards, and then images are trimmed down from the one sheet. I'm trying to avoid manually adding the 3 mm to each of the different sized boxes which I have about 150 images.
Regards
Simon
2 Correct answers
There is no error handling - I'm not very good in JS - but as long as you select some objects and set values - you should be fine 😉
var myResizeX = 3;
var myResizeY = 3;
var myObj;
var mySel = app.selection;
for (var a=0;a<mySel.length;a++)
{
myObj = mySel[a];
myObj.geometricBounds = [ myObj.geometricBounds[0]-myResizeY, myObj.geometricBounds[1]-myResizeX, myObj.geometricBounds[2]+myResizeY, myObj.geometricBounds[3]+myResizeX];
myObj.fit(FitOptions.FILL_PROPORTIONALLY);
};
myResiz
...OK.
You've copied code in the middle of me posting it - I've made a mistake so I've edited it a minute later 🙂
Please REMOVE "[a]" in the "fit" line - it should be:
myObj.fit(FitOptions.FILL_PROPORTIONALLY);
Copy link to clipboard
Copied
If you work on a PC, I can give you access to the full version of my ID-Tasker tool for a few days.
If you need scripting solution anyway - you need to give more info - from which corner the resizing should be performed - or from the center?
Copy link to clipboard
Copied
I work on a Mac I'm afraid.
Resizing from the centre outward for each frame selected. So if I select 100 frames that are all different sizes I'm hoping I can expand each of their sizes by 3 mm each side from the centre. example a 200 x 300 mm frame would end up being 206 x 306 mm, a 400 x 425 mm frame would become 406 x 431 mm etc. Each frame will have a different image in the frame before I apply the 3 mm resize script.
Copy link to clipboard
Copied
There is no error handling - I'm not very good in JS - but as long as you select some objects and set values - you should be fine 😉
var myResizeX = 3;
var myResizeY = 3;
var myObj;
var mySel = app.selection;
for (var a=0;a<mySel.length;a++)
{
myObj = mySel[a];
myObj.geometricBounds = [ myObj.geometricBounds[0]-myResizeY, myObj.geometricBounds[1]-myResizeX, myObj.geometricBounds[2]+myResizeY, myObj.geometricBounds[3]+myResizeX];
myObj.fit(FitOptions.FILL_PROPORTIONALLY);
};
myResizeX and myResizeY - you should enter HALF of what you want the objects to be resized by.
So if you need "6" - you need to enter "3" - as above.
Also, script "uses" your current measurement units. So if you work in "mm" - it will add "3 mm" to all sides. If you work in "inch" - it will add "3 in", and so on.
It also fills content in frame:
myObj.fit(FitOptions.FILL_PROPORTIONALLY);
You can find all possible options here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#FitOptions.html
Just in case:
https://creativepro.com/how-to-install-scripts-in-indesign/
https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post/
Copy link to clipboard
Copied
OMG wow. this is quite amazing as i'm a total newbie to scripts. those links to how to install extremely helpful as well as I wouldn't have known. I managed to copy the script and place in a Mac TextEdit file and save as text only (very important step) and then relabelled as .jsx file and placed in Scripts Panel. It's working (AMAZING) but it can only do it ONE at a time. If I select more than one object it will only update one of the objects and not apply to any other objects selected. This is great anyway to be able to do one at a time automatically with a script but is there a way it can do multiple objects as well? So if I select 50, 100, 150 objects it will apply the resize to all of them?
Copy link to clipboard
Copied
It should do all selected objects? I've tested it and it was working for me?
How do you select your objects?
Can you post some screenshots of what you've selected?
Copy link to clipboard
Copied
oh that's interesting. and also gives me hope it'll eventually work for me.
have attached screen grabs of a test file. Adobe Indesign CC v14, Mac OS Sierra (yep, old iMac at home) — but i have a newer imac and indesign at work yet to test on.
Screengrabs show:
1. multiple frames selected.
2. script chosen (you get the error message which I ignore)
3. one of the frames changed size, but all other frames didn't change.
hope this helps.
simon 🙂
Copy link to clipboard
Copied
Can you select only TWO frames - by clicking on each one with Shift - not by drawing an area?
Script will fail if you by accident select object that can't be resized - like a line?
Like I've said before - it's a crude solution, without ignoring errors.
I'll try to add error handling.
Copy link to clipboard
Copied
thanks for the suggestion. I selected 2 frames (filled boxes, no lines) using Shift. But unfortunately still the same result, only 1 frame resizes. It's a bit of a mystery. screenshot attached. thanks so much for your time and expertise.
Copy link to clipboard
Copied
OK.
You've copied code in the middle of me posting it - I've made a mistake so I've edited it a minute later 🙂
Please REMOVE "[a]" in the "fit" line - it should be:
myObj.fit(FitOptions.FILL_PROPORTIONALLY);
Copy link to clipboard
Copied
I think we have a winner! Woohoo! Amazing. This will save many so many hours using this script. Thank you so much for your generosity and expertise. You've made me realise the power of scripts is strong 🙂
Copy link to clipboard
Copied
You are welcome.
This is NOTHING in comparison what you could do with my ID-Tasker tool on a PC...
Script I've created for you - is highly limited - it only works on current selection - which you need to do on every page / spread. And if you need some new functionality - you need to ask someone to modify it or create a new script.
ID-Tasker is like Actions in Photoshop, but without recording possibility, you need to build Task from "rules" / commands.
You can specify what kind of object(s) you want to process - type, size, location, linked folder, applied style, whatever - and how you want to process them. And then you can process 100s of INDD files - whole servers.
And at the same time - export processed files to PDF / JPEG / etc. and upload to an FTP server.
And that's just a tip on an enormous iceberg. Then there are Texts, Tables, XML, all Styles, Hyperlinks, DataMerge, etc.
And you've direct access to the complete internal structure of your document - all 800+ object properties, 400+ Text / Table, 1000+ Document, etc.
WHATEVER you can click in InDesign - or many other applications - ID-Tasker can click for you. So if someone is doing a lot of mundane clicking...
Copy link to clipboard
Copied
That simply blows my mind. I never knew such things existed. That's incredible. Although what you've created for me is life-changing in my work process.
Does a script exist that can move different sized frames on a page to fit as neatly as possible to save space between them to a certain distance apart? Is that getting into AI territory perhaps where it looks at shapes like a jigsaw puzzle and can determine the best way to fit as many frames as possible on the one sheet.
I've attached my overall current work process of what i'll be doing and how i'm using your awesome script:
1. have an elevation of a exhibition which will have many different sized frames with images. it's at a scale of 1:100
2. i'll then take a copy and align top and left of all images and then space them out 0.2mm horizontally (this will allow 20 mm between them once at 1:1 scale) to allow crop marks and bleed.
3. will then manually place them on a sheet size grid i've created and work out best way to arrange to save space and fit as many as I can (this is where I wonder if there's a script for this but I think it involves more human assessement rather than computer assessement to work)
4. will then copy and paste each sheet grid layout to a 1:1 sheet size, enlarge by 10000% so it's 1:1
5. apply crop marks to all picture frames (using Indesign standard script), apply 3mm bleed to all picture frames (this is where your amazing script does it's magic), apply fit content to frame for all (that can be done easily all at once within indesign, but i know it can be part of your script as well if need be).
6. export each final pages as PDF for printer. they print on large sheet and trim images to crop marks provided.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
OMG! This looks very promising. Will investigate and have my fingers crossed 🙂 #loveyourwork

