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

Use actual page size in AppleScript, not document setup size.

Community Beginner ,
Sep 12, 2018 Sep 12, 2018

Copy link to clipboard

Copied

Hi all,

Hope somebody could point me in the right direction...

I have a droplet app written in AppleScript. It looks for the page size of the documents dropped and uses that info. Just for testing I have a dialog at the end which returns this.

The problem;

The app only returns the document size, as in the size displayed in the 'Document setup' window. I need to use the actual page size, as a large number of my clients use the page tool to adjust the page sizes. I need it to always use the actual page size.

Has anyone run into a similar problem?

My code is below, thanks in advance for any help

on open mgItems

  repeat with mgThisItem in mgItems

  tell application id “com.adobe.InDesign”

  try

  open mgThisItem

  tell active document

  my get_documentSizes()

  tell document preferences

  tell document preferences

  set overallwidth to page width

  set overallHeight to page height

  end tell

  end tell

  end tell

  close active document

  on error

  -- decide what kind of error handling you want to include if the file won’t open

  end try

  end tell

  -- rest of script for email processing here

  end repeat

  display dialog overallwidth

end open

TOPICS
Scripting

Views

954

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
Engaged ,
Sep 12, 2018 Sep 12, 2018

Copy link to clipboard

Copied

this will return the correct page size, round to closest whole numbers

on open mgItems

    repeat with mgThisItem in mgItems

        tell application id "com.adobe.InDesign"

            try

                open mgThisItem

                tell active document

                    set {a, b, c, d} to bounds of page 1

                    set PG_HEIGHT to round c

                    set PG_WIDTH to round d

                end tell

                close active document saving no

                display dialog "Height " & PG_HEIGHT & "mm" & "  Width " & PG_WIDTH & "mm" as string giving up after 3

            on error

                -- decide what kind of error handling you want to include if the file won’t open

            end try

        end tell

        -- rest of script for email processing here

    end repeat

end open

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 Beginner ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

Thanks, managed to plug this code in and use perfectly !

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 ,
Sep 23, 2018 Sep 23, 2018

Copy link to clipboard

Copied

LATEST

Hi Lucas,

did you test the script with a document where the spread view was rotated?

Regards,
Uwe

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