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

The initial value of mValueTX and mValueTY

Contributor ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Hello.

Does the initial values of mValueTX and mValueTY of the object just generated refer the upper left coordinates of the document's largest area? For example, TextFrameItem and PlacedItem.

I want to get the coordinates of the document's largest area easily. Do you have any sugesstions?

I referred to here.

How to get bounds of largest possible document area?

This script worked fine on Illustrator CS6, CC2015, CC2017, CC2018 (for mac).

Is this correct?

function getLargestBounds() {

    var tempLayer,

        tempText,

        left,

        top,

        LARGEST_SIZE = 16383;

    if (!app.documents.length) {

        return;

    }

    tempLayer = app.activeDocument.layers.add();

    tempText = tempLayer.textFrames.add();

    left = tempText.matrix.mValueTX;

    top = tempText.matrix.mValueTY;

    tempLayer.remove();

    return new Rect(

        left,

        top,

        left + LARGEST_SIZE,

        top + LARGEST_SIZE

    );

}

var rect = getLargestBounds();

// cover the whole area.

app.activeDocument.pathItems.rectangle(rect[1], rect[0], 16383, 16383);

TOPICS
Scripting

Views

1.0K

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
Contributor ,
Mar 02, 2018 Mar 02, 2018

Copy link to clipboard

Copied

canvas.png

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 ,
Mar 04, 2018 Mar 04, 2018

Copy link to clipboard

Copied

Hi OMOTI, that seems to be correct. It works, thanks for sharing!!

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 ,
Mar 05, 2018 Mar 05, 2018

Copy link to clipboard

Copied

Hi CarlosCanto, thank you for testing.

Which is your OS, Windows or macOS?

I wish I could know the Windows information.

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 ,
Mar 05, 2018 Mar 05, 2018

Copy link to clipboard

Copied

Windows 10, CC2018.

I used to use the previous methods mentioned in the link, luckily I've only needed to find the absolute 0,0 on new documents when conditions are know. This method is more reliable.

thanks

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 ,
Mar 06, 2018 Mar 06, 2018

Copy link to clipboard

Copied

thanks for your help.

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 ,
Apr 11, 2018 Apr 11, 2018

Copy link to clipboard

Copied

LATEST

I'm sorry. The coordinates of the return value were incorrect.

Correctly here.

return new Rect(

     left,

     top,

     left + LARGEST_SIZE,

     top - LARGEST_SIZE

);

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