Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting - getting anchor positions

Status
Not open for further replies.

alanbloom

Technical User
Apr 22, 2005
81
GB
Hi, (thanks for reading this!)

I want to be able to write a script that will take a path that I have created and turn it into graphable data in excel.

The method I thought was a path that had many anchor positions on it (so many that it would still be ok to have each anchor as a point rather than curve). Then a script that took the coordinates of an achor, save them and then move onto the next anchor, etc.

I can't figure out how to do that with apple script. How would you tell it which anchor you wanted, how many anchor points there are and how to copy the coordinates into memory? I do have a scripting book but it's still not clear how to do it :-s

Thanks

Alan Bloom
 
Worked out most of it:
-----------------------------------------------

tell application "Illustrator CS"
activate
if (count path items of document 1) > 0 then
set anchorList to (anchor of every path point of path item 1 of document 1)
end if

make new text frame in document 1 with properties {name:"Text1", position:{100, 550}}

set coOrdinates to "x) "
repeat with myItem in anchorList
set coOrdinates to coOrdinates & myItem & return
end repeat

set the contents of text frame "Text1" of document 1 to coOrdinates
end tell
-----------------------------------------------

But still one problem with it - when the numbers are put into the text box, there is no gap between the x and y coordinates.... so I can't get them separated. Any suggestions?
Cheers

Me again
 
I've got a very limited understanding of how anchorList gets it's values and hence I don't know of any way to separate the x and y components. I just dumped the whole lot into that string.

Trouble is that myItem is the combination of x and y in the script above...

It's a remarkable high level language but as such is difficult to predict what will work and what doesn't and also the vocabulary available...

:-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top