Re: Handler Call "can't continue" Illustrator CS
Re: Handler Call "can't continue" Illustrator CS
- Subject: Re: Handler Call "can't continue" Illustrator CS
- From: pete boardman <email@hidden>
- Date: Fri, 7 Oct 2005 19:48:31 +0100
I can't help you with CS, 'cos I'm still using 10. I don't seem to
have text frames... However, I got something similar working, which
might be of some help. Notice:
- you can use the "my ..." word rather than ask the Finder to run the
replace_chars handler.
- I found that I had to de-reference the Illustrator objects (in my
case, text art items), and set their new contents within the AI block.
- if your replace_chars handler is trying to replace the text of an
AI object, you'll need to send that command to AI. Your handler is
running outside.
- you might find it useful to insert a few "log class of ..."
statements, so that you can see whether you're really dealing with
strings or some AI object or reference. Once you've got a string, you
can deal with it locally.
--
tell application "Adobe Illustrator 10"
activate
tell document 1
repeat with t in text art items
set ourText to contents of contents of t -- it's now a
string
set findIt to "asd"
set replaceItWith to "ho ho ho"
set x to my replace_chars(ourText, findIt, replaceItWith)
set contents of contents of t to x
end repeat
end tell
end tell
on replace_chars(this_text, _bad, _good)
set AppleScript's text item delimiters to the _bad
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the _good as string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
--
hth
Pete
_______________________________________________
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