• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Indesign CS5 - getting width and height of selection?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indesign CS5 - getting width and height of selection?


  • Subject: Re: Indesign CS5 - getting width and height of selection?
  • From: Håvard Graudo <email@hidden>
  • Date: Wed, 08 Feb 2012 13:43:29 +0100

Den 8. feb. 2012 kl. 13.16 skrev Shane Stanley:

> On 08/02/2012, at 11:10 PM, Håvard Graudo wrote:
>
>> Thank you for the code, it does work, but I was hoping to just get the values without changing the items.
>> There will be surprises with grouping across layers, items may belong to other groups etc.
>>
>> Skipping the MOVE part and only group and calculate (y2-y1, x2-x1) would reduce risk a bit, but it is still a roundabout way of getting the values:
>>
>> Since the values I am after are displayed in the Control Panel I was hoping to just pick them up from somewhere.
>> If someone knows how to access that info I would appreciate it.
>
> Your choices are to get the bounds of all the items and do the sums yourself, or use something like Jan's script, but after grouping (and getting the measurement) use undo rather than ungroup. That will avoid any change to groups and layers.



Thank you

Here is what I did. In case someone else need it. (Hello user from the future searching the archives!)

Håvard


------

tell application "Adobe InDesign CS5"

	set mySelection to selection
	set myDoc to active document
	tell myDoc

		-- get and store exotic user settings:
		set gmlRuler to ruler origin of view preferences
		set gmlZero to zero point
		set {gmlHor, vmlVrt} to {horizontal measurement units of view preferences, vertical measurement units of view preferences}

		-- make sure only millimeters are valid and measurement is across spreads:
		set zero point to {0, 0}
		set {horizontal measurement units of view preferences, vertical measurement units of view preferences} to {millimeters, millimeters}
		set ruler origin of view preferences to spread origin

			set {y1, x1, y2, x2} to {99999, 99999, -99999, -99999} -- just some high dummy values
		repeat with anItem in mySelection
			set {ny1, nx1, ny2, nx2} to geometric bounds of anItem
			if ny1 < y1 then copy ny1 to y1
			if nx1 < x1 then copy nx1 to x1
			if ny2 > y2 then copy ny2 to y2
			if nx2 > x2 then copy nx2 to x2
		end repeat
		set {h, b} to {(y2 - y1), (x2 - x1)}

		--clean up if for non-metric users
		set ruler origin of view preferences to gmlRuler
		set zero point to gmlZero
		set {horizontal measurement units of view preferences, vertical measurement units of view preferences} to {gmlHor, vmlVrt}

		return {round h, round b}
	end tell
end tell

------





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Marquee selecting InDesign CS5
      • From: "Houston, Brad" <email@hidden>
References: 
 >RE: Indesign CS5 - getting width and height of selection? (From: email@hidden)
 >Re: Indesign CS5 - getting width and height of selection? (From: Håvard Graudo <email@hidden>)
 >Re: Indesign CS5 - getting width and height of selection? (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: Indesign CS5 - getting width and height of selection?
  • Next by Date: Marquee selecting InDesign CS5
  • Previous by thread: Re: Indesign CS5 - getting width and height of selection?
  • Next by thread: Marquee selecting InDesign CS5
  • Index(es):
    • Date
    • Thread