Text fields actually use Unicode texts, not strings. AppleScript (or
the text field object, not too sure on the internals) is coercing it
for you. If you then set a variable to the text field's contents, it
will be a unicode text, and barring a new coercion to a string, will
send "bad characters" (eg, the text in the wrong encoding) to the
central database. When just putting anything between two quotes,
AppleScript will assume its a string (which, in the case of AppleScript
Studio, I *really* wish they'd change to a defaul of Unicode text, and
allow UTF-16 source code files).
To coerce them out, just say something like
set txtByline to (contents of "txtByline" of window "winStory") as
string
Parentheses might not be necessary.
Matthew Stuckwisch
Senior, Spanish and New Media
University of Alabama
On Mar 22, 2005, at 11:40 AM, Jim Trebilcock wrote:
Hello,
I've run into an interesting snag while porting my OS 9
AppleScript-based programs to AS Studio.
One program my reporters use standardizes "slugs" (story names)
and inserts byline coding when stories are created in our central
database. In my AS Studio version of this longstanding program, any
text that has been entered in an AS studio text field is reported as
having "bad characters" by our database. If I hardcode the string in
my AS Studio program and avoid the text fields (set txtByline to "Jim
Trebilcock" instead of set txtByline to contents of text field
"txtByline" of window "winStory"), this works fine and the database is
happy.
Question: What is being returned by AS Studio text fields that
is NOT being returned by a vanilla AppleScript string? How can I
coerce these items out of the byline (and other) strings when read
from an AS studio text field?
Thanks
--
email@hidden
__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at
http://isp.netscape.com/register