Adobe Illustrator CS5 - Align Objects (right)

Hi there,

Is there a way to align (right) some selected objects via AppleScript?

Thanks for your help

Cheers
Marth

That’s a pretty broad request, Marth and in AI scripting, the specifics really matter with positioning. What are you trying to do and what have you tried?

Jim
BLUEFROG

Hi Jim!

Thank’s for your Message! :slight_smile:

Here’s a picture of a business card, I’m working with:

http://s12.postimage.org/gw349sje5/Bildschirmfoto_2011_12_21_um_07_30_57.png

What I try to do is, I want the eMail & URL Ligne to algin with the other Lines above.

Here is what I’ve got:



tell application "Adobe Illustrator"
	tell document 1
		set FontSize to 6.5
		
		set theTXTCount to count text frames
		
		set theLeftTextList to {}
		
		repeat with i from 1 to theTXTCount
			
			set selection to {page item i}
			set theitem to item 1 of selection
			
			set thePos1 to item 1 of position of theitem
			set thePos2 to item 2 of position of theitem
			
			if thePos1 < 5.6 then
				set position of theitem to {6.0, thePos2}
				set size of line 1 of text frame i to FontSize
				set size of line 1 of text frame (i - 1) to FontSize
			end if
			
			set pos1 to item 1 of position of text frame i
			
			if thePos1 < 100 then
				if i is not theTXTCount then
					copy "text frame " & (i as number) & ", " to the end of theLeftTextList
				else
					copy "text frame " & (i as number) to the end of theLeftTextList
				end if
			end if
			
		end repeat
		
		set theLeftCount to count every item of theLeftTextList
		set theLeftText to theTXTCount - theLeftCount + 1
	
		set txt to theLeftTextList as string
		
		
		repeat with x from theLeftText to theTXTCount
			set selected of (text frame x) to true
		end repeat
		
		
		
	end tell
end tell


In this Script I select all the lines on the left side.

Thank you for your help!

Cheers
Marth

A strange way to go about this. Set paragraph justification to right. Then you can just make the first item of the anchor the same in all cases.

If you create a text block and right align then there is no need to fuss with aligning the individual text objects. A plus is that you can use paragraph spacing and leading to consistently and precisely space the lines of text.

As to the original question yes you should be able to do it using a bounds property, would need to look it up to figure out the right syntax. You would probably still want to right align all your text objects so that if you need to make any edits you don’t have to re-align the items.