G’day
The following creates a text box in a particular position in an illustrator document.
We’d like to set the text to outlined from the ‘Type:Create Outlines’ (keystroke “o” using {command down, shift down}) menu, but trying to click on the text doesn’t seem to select it correctly.
Is there any way of setting the outline directly in the text box?
Regards
Santa.
if name of theObject = "DrawTheText" then
if (integer value of button "AppendName" of window "Final Die") = 1 then
set theInitials to content of text field "DieAddText" of window "Final Die" as text
set AlignText to (integer value of button "AlignCrop" of window "Final Die") = 1
if not textDrawn then
tell application "Adobe Illustrator"
set docName to name of current document
set thisdoc to current document
try
make new character style in thisdoc with properties {name:"SantaStyle1"}
end try
set the size of character style "SantaStyle1" of thisdoc to 14
tell thisdoc
set the fill color of character style "SantaStyle1" of thisdoc to {class:CMYK color info, cyan:0, magenta:0, yellow:0, black:100}
end tell
set the text font of character style "SantaStyle1" of thisdoc to text font "Geneva"
tell document 1
try
set visible of layer "Original Layer" to false
end try
try
set visible of layer "Working Layer" to false
end try
try
set visible of layer "Final Layer" to true
set locked of layer "Final Layer" to false
end try
set h to height
set GB to geometric bounds
set VB to visible bounds
set CM to crop marks
set theXLeft to item 1 of GB
set theYTop to item 2 of GB
set theXRight to item 3 of GB
set theYBottom to item 4 of GB
if item 1 of VB > theXLeft then set theXLeft to item 1 of VB
if item 2 of VB < theYTop then set theYTop to item 2 of VB
if item 3 of VB < theXRight then set theXRight to item 3 of VB
if item 4 of VB > theYBottom then set theYBottom to item 4 of VB
if item 1 of CM > theXLeft then set theXLeft to item 1 of CM
if item 2 of CM < theYTop then set theYTop to item 2 of CM
if item 3 of CM < theXRight then set theXRight to item 3 of CM
if item 4 of CM > theYBottom then set theYBottom to item 4 of CM
set theString to theInitials -- tempWindowName & " " & theInitials
set DownOffset to 47
if AlignText then
set DownOffset to 27
repeat with x in paragraph 2 of theString
if x is in {"g", "j", "p", "q", "y", ",", ";"} then set DownOffset to 30
end repeat
end if
try
if AlignText then
set theText to make new text frame at beginning with properties {kind:point text, contents:theString, position:{(theXLeft + 1), (theYTop + DownOffset)}}
else
set theText to make new text frame at beginning with properties {kind:point text, contents:theString, position:{(theXLeft + 1), (theYTop + DownOffset)}}
end if
apply character style character style "SantaStyle1" to text range of theText
--set properties of text range of theText to {text font:text font "Geneva", size:14}
on error errmsg number errnum
display dialog "Draw text " & errmsg & return & errnum
end try
set textDrawn to true
activate
tell application "System Events" to tell process "Adobe Illustrator"
keystroke "v" -- selects the selection tool
delay 1
click at {(theXLeft + 20), (theYTop + DownOffset - 10)} -- This should click on the text
delay 1
try
keystroke "o" using {command down, shift down}
end try
end tell
end tell
end tell
if (integer value of button "ExpandCrop" of window "Final Die") = 1 then
tell application "Adobe Illustrator"
if AlignText then
set crop marks of document 1 to {theXLeft - 2, theYTop + DownOffset + 3, theXRight + 2, theYBottom - 2}
else
set crop marks of document 1 to {theXLeft - 2, theYTop + DownOffset + 3, theXRight + 2, theYBottom - 2}
end if
end tell
else
if h - theYTop < (DownOffset + 3) then
tell application "Adobe Illustrator"
try
set crop marks of document 1 to {(item 1 of CM), (item 2 of CM) + (h - theYTop) + (DownOffset + 3), item 3 of CM, item 4 of CM}
end try
end tell
end if
end if
end if
end if
end if