Can't copy string to clipboard

I’m trying to write a little script for InDesign CS2. It looks like it’s working except for one thing.

tell application "Adobe InDesign CS2"
	set mystring to name of fill color of selection
	copy mystring to clipboard
	duplicate selection
	move selection by {0, 0.6172}
	resize selection vertical scale 35.7
	set fill color of selection to "None"
	tell application "Adobe InDesign CS2"
		paste mystring
	end tell
end tell

I highlight a rectangle that’s filled with a color (let’s say “Red”) and run the script. I want the script to:

Look up the name of the color of the box (in this case Red)
Duplicate the box in place
Move the duplicate down a set amount relative to the original
change the size of the duplicate
remove the color of the duplicate
paste in the name of the color of the original

So in this case I get the error

Am I doing something wrong, or can’t InDesign copy a string of text?

rich

The color “Red” or any other has a triplet color value, either three decimal numbers between 0 and 64K {50000, 12219, 15170}, the hex equivalents of those, or for the web, often 8-bit color values are used, but expressed as three two character hex “digits” {C32F3B} – you’d have to copy whatever form inDesign uses to the clipboard; not the name.

Hi rich

Not sure if i don’t understand what you’re trying to do but
wouldn’t you be better just creating a text frame with the name of the color in it.
do you want the name to go in the duplicate box?
if you just want to carry on down the route your going then:

tell application "Adobe InDesign CS2"
	set mystring to name of fill color of selection
	set the clipboard to mystring
	duplicate selection
	move selection by {0, 0.6172}
	resize selection vertical scale 35.7
	set fill color of selection to "None"
	tell application "Adobe InDesign CS2"
		paste
	end tell
end tell

this should work.
But it’s not gonna put the text in the duplicate box.
I think the paste command just throws it into the center of the screen.
if you want it in the box then the box needs converting to be a text box.
therefore you might aswell make it in the script instead of going down the copy and paste route…

Hi rich

Try this without using the clipboard:

tell application "Adobe InDesign CS2"
	set mystring to name of fill color of selection
	duplicate selection
	move selection by {0, 0.6172}
	resize selection vertical scale 35.7
	set fill color of selection to "None"
	tell application "Adobe InDesign CS2"
		tell document 1
			tell selection
				set content type to text type
				set contents to mystring
				bring to front
			end tell
		end tell
	end tell
end tell

Pidge,

YOU ARE MY FREAKIN’ HERO!!

Thanks!!!
rich