• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to placing Linked File on the Left Bottom edge of document

Contributor ,
Jul 10, 2023 Jul 10, 2023

Copy link to clipboard

Copied

I’m trying to create a script that will place a link image at the bottom left edge of the current document irregardless of the size of the image.

 

I can use the X axis = 0 to place it at

the left edge but can't figure out how to place it on the bottom edge?

 

Is there a way to do this?

TOPICS
Actions and scripting

Views

104

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jul 10, 2023 Jul 10, 2023

Copy link to clipboard

Copied

Hi @evan.sante the issue you are facing is while X axis is consistent at 0, the orientation is based on top right as 0,0 XY.

The Y axis is variable according to your post so I'm not sure this is possible with a script.

One far out idea is to create a script that flips the document orientation so that the image is placed in the upper left corner 0,0 - then the document flips orientation back to original after the image is placed. The image would be placed backwards but when flipped is in the right orientation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 10, 2023 Jul 10, 2023

Copy link to clipboard

Copied

That's a great solution but unfortunately the File is Text so it doesn't accomplish what I need... Thank You

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2023 Jul 10, 2023

Copy link to clipboard

Copied

@evan.sante 

 

You can use the following scripted version of the alignment options in the move tool:

 

alignToSel('AdBt');

function alignToSel(method) {
    //www.ps-scripts.com/viewtopic.php?f=66&t=7036&p=35273&hilit=align+layer#p35273
    /*
    //macscripter.net/viewtopic.php?id=38890
    AdLf = Align Left
    AdRg = Align Right
    AdCH = Align Centre Horizontal
    AdTp = Align Top
    AdBt = Align Bottom
    AdCV = Align Centre Vertical
    */
    
    app.activeDocument.selection.selectAll();

    var desc = new ActionDescriptor();
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    desc.putReference(charIDToTypeID("null"), ref);
    desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method));

    app.activeDocument.selection.deselect();

    try {
        executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
    } catch (e) {}
}

 

https://gist.github.com/MarshySwamp/df372e342ac87854ffe08e79cbdbcbb5

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 11, 2023 Jul 11, 2023

Copy link to clipboard

Copied

LATEST

Thank You... I will try it out. - CES 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines