Skip to main content
dsomrz
Known Participant
Nov 13, 2024 5:33 PM UTC
Question

Align Script

Trying to develop a script that will align an object horizontally center and vertically to bottom.

This is what I have but can't get it to align to the bottom

 

tell application "Adobe InDesign 2025"

                set selList to selection --assumes more than one item selected

                tell document 1

                                align align distribute items selList align option horizontal centers

                                align align distribute items selList align option vertical centers

                end tell

end tell

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Community Expert
Nov 16, 2024 8:47 AM UTC
tell application "Adobe InDesign 2025"
    set selList to selection -- assumes items are selected
    tell document 1
        -- Align horizontally to center
        align align distribute items selList align option horizontal centers

        -- Align vertically to bottom
        align align distribute items selList align option bottom edges
    end tell
end tell

 

as per @leo.r 

Translate
dsomrz
dsomrzAuthor
Known Participant
Nov 18, 2024 7:16 PM UTC

Thank you. I got this from someone. it aligns the image to the page centered horizontally and vertically .1875" from the bottom of the page.

 
// Align a page item relative to the page
 
(function () {
 
var frame = app.selection[0];
 
var pb = frame.parentPage.bounds;
var pageVCentre = pb[2]/2;
var pageHCentre = pb[3]/2;
 
var gb = frame.geometricBounds;
var frameVCentre = gb[0] + ((gb[2]-gb[0])/2);
var frameHCentre = gb[1] + ((gb[3]-gb[1])/2);
var frameBottom = gb[2];
 
frame.move (undefined, [
pageHCentre - frameHCentre, // x-move
//pageVCentre - frameVCentre  // y-move, frame bottom to page centre
//pageVCentre - frameBottom   // y-move, frame bottom to page centre
pb[2] - frameBottom - 0.1875   // y-move, frame bottom to page bottom
]);
 
}());
Translate
leo.r
Community Expert
Community Expert
Nov 16, 2024 12:19 AM UTC

have you tried bottom edges?

Translate
kglad
Community Expert
Community Expert
Nov 13, 2024 8:28 PM UTC

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">
Translate