Copy link to clipboard
Copied
Can there be a script that makes object A the same size as object B?
Here are two scenarios:
The first, being a graphical object, lets A be equal in size to the target B.
The second, if A is a picture and B is its caption, let B and A have two widths.
The second is the most desirable, because very often the caption needs to be re-widened after the picture size is changed. It's a pain in the ass when you have a lot of them.
If you choose an image and a static caption, you can have the caption quickly aligned to the image, including position and width. It would save a lot of work.
<Tiitle renamed by MOD>
var myGraphicFrame = app.selection[0];
var myTextFrame = app.selection[1];
myTextFrame.geometricBounds = [ myGraphicFrame.geometricBounds[2], myGraphicFrame.geometricBounds[1], myTextFrame.geometricBounds[2], myGraphicFrame.geometricBounds[3] ];
(^/)
myTextFrame.geometricBounds = [ myGraphicFrame.geometricBounds[2], myGraphicFrame.geometricBounds[1], myGraphicFrame.geometricBounds[2]+(myTextFrame.geometricBounds[2] -myTextFrame.geometricBounds[0]), myGraphicFrame.geometricBounds[3] ];
Take this one:
/*
_FRIdNGE-0766_ImageCaptionAlignment.jsx
Script written by FRIdNGE, Michel Allio [02/11/2024]
*/
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, 'Image And Caption Alignment');
function main() {
var myDoc = app.activeDocument;
var myRulerOrigin = myDoc.viewPreferences.rulerOrigin;
if ( app.selection.length != 2 ) {
alert( "Select 2 items!")
exit();
} else {
if ( app.selection[0]
...
Copy link to clipboard
Copied
Thé script checks itself the type of frame. So no need.
(^/)
Copy link to clipboard
Copied
How to make the error box disappear automatically after 1 second.
Thank you very much.