• 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
Illustrator CS Rotation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Illustrator CS Rotation


  • Subject: Illustrator CS Rotation
  • From: Rob Stott <email@hidden>
  • Date: Tue, 19 Apr 2005 08:20:09 +0100

Hi there,

I've been trying to work out how to tell if an Illustrator CS text frame has been rotated or not - I thought I'd cleverly solved this a few weeks back but it turns out I haven't. I wondered if anyone here has any suggestions. Just to clarify, for the purposes of this script:

• All text frames are rectangular
• All text frames are made of four anchor points
• Text frames are only ever rotated by multiples of 90º (90, 180, 270, 360 (or 0) )

This seemed to do the job at first...

tell application "Illustrator CS"
tell front document
tell text frame 1
--this is part of a larger script - I have theProperties already
set theProperties to the properties


set theTextPath to the entire path of text path of theProperties


--get the co-ordinates of each anchor point
set thePoint1Coords to anchor of item 1 of theTextPath
set thePoint2Coords to anchor of item 2 of theTextPath
set thePoint3Coords to anchor of item 3 of theTextPath
set thePoint4Coords to anchor of item 4 of theTextPath


--perform tests to check rotation, this works on the principle that
--point 1 is always point 1, no matter how its rotated.
if (item 1 of thePoint1Coords > item 1 of thePoint3Coords) and (item 2 of thePoint3Coords > item 2 of thePoint1Coords) then set theRotation to 0
if (item 1 of thePoint4Coords > item 1 of thePoint2Coords) and (item 2 of thePoint2Coords > item 2 of thePoint4Coords) then set theRotation to 90
if (item 1 of thePoint3Coords > item 1 of thePoint1Coords) and (item 2 of thePoint1Coords > item 2 of thePoint3Coords) then set theRotation to 180
if (item 1 of thePoint2Coords > item 1 of thePoint4Coords) and (item 2 of thePoint4Coords > item 2 of thePoint2Coords) then set theRotation to 270


display dialog "The text frame is rotated " & theRotation & "º clockwise"
end tell
end tell
end tell




...
but this seems to fall down for some text frames - it seems the anchor points aren't always in the same order in every text frame. Maybe this has something to do with how they were drawn by a user? Either way, it's usually (but not always) correct which unfortunately isn't good enough! ;-)

Has anyone got a more reliable way of checking to see if a box has been rotated or not?

Any suggestions much appreciated.

Regards
Rob

---

Rob Stott
- Development Team, Trident UK
Connaught Road, Kingswood, East Yorkshire HU7 3AP
Work: +44 (0) 1482 710344 • Mobile: +44 (0) 7881 811533 • Home: +44 (0) 1482 671129

My work: http://www.apple.com/uk/creative/trident/
My schedule: http://ical.mac.com/robstott/Robs32Schedule
My band: http://www.superscapemusic.co.uk
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Illustrator CS Rotation
      • From: "Shane Stanley" <email@hidden>
References: 
 >Re: File Name Change (From: kai <email@hidden>)

  • Prev by Date: Re: Scripting in quark...
  • Next by Date: Re: Illustrator CS Rotation
  • Previous by thread: Re: File Name Change
  • Next by thread: Re: Illustrator CS Rotation
  • Index(es):
    • Date
    • Thread