🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15345

Re: AS - drawing a box on the active page?

#15345
From: Casey D'Andrea
Date: Mon, 08 Dec 2003 22:55
36 lines
2907 bytes
Here is what I ended up doing. Keep in mind this would work with a document with no more than 2 pages in a spread. This does not use facing pages as facing pages would use the opposite coordinates for placing the frames since odd pages start on the right side.

Given the example below, could I not identify whether the document contains facing pages or standard pages? If so, where would I dump that to minimize the code. Could I insert another nested if statement. See bold section of code below

if item 2 of view preferences = false then
                        set imageLeft to imageLeft - imageLeft - 110
                  else
                        set imageLeft to imageLeft + 20
                  end if

I defined another variable, endDigit, as the last character of cPageNum. This way, if there are more than 9 pages, it will return the value I need. I then inserted an quick if statement that included some boolean statements. The result is that if the user is on a left (odd) page the frame is drawn just outside the top left, or if they're on an right (even) page the frame is drawn just outside the top right.

set cPageNum to active page of layout window 1 of myDocument
      set cPageNum to name of cPageNum
      tell page cPageNum of myDocument
            set endDigit to last character of cPageNum
            if (endDigit = "1") or (endDigit = "3") or (endDigit = "5") or (endDigit = "7") or (endDigit = "9") then
                  set imageTop to item (3) of bounds
                  set imageLeft to item (4) of bounds
                  set imageTop to 0
                  if item (2) of bounds = false then
                        set imageLeft to imageLeft - imageLeft - 110
                  else
                        set imageLeft to imageLeft + 20
                  end if
            else
                  set imageTop to item (3) of bounds
                  set imageLeft to item (4) of bounds
                  set imageTop to 0
                  if item (2) of bounds = false then
                        set imageLeft to imageLeft + 20
                  else
                        set imageLeft to imageLeft - imageLeft - 110
                  end if
            end if
      end tell
Technical Details
Message-ID: <2ccec6d8.3@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccec6d8.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,129671036175acbc
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-12-08 15:07:59 PST
From: "Casey D'Andrea" <kcjones76@cogeco.ca>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: AS - drawing a box on the active page?
Message-ID: <2ccec6d8.3@webx.la2eafNXanI>
Date: Mon, 8 Dec 2003 14:55:39 -0800
References: <2ccec6d8.-1@webx.la2eafNXanI>
Lines: 48
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit