• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Text, Unicode Text, and String coercion ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text, Unicode Text, and String coercion ...


  • Subject: Text, Unicode Text, and String coercion ...
  • From: Brian Johnson <email@hidden>
  • Date: Wed, 19 Jan 2005 11:53:28 -0800 (PST)


I'm confused, bewildered and befuddled by the behavior of one of my scripts. It was born under OS-9 and used an FMPro database to store info. It extracts much of that as lists or just plain text. It then uses this info to drive "clip2gif" (c2g) and create graphics. Under 9 that all worked..


I'm now bringing this along to OS-X and mysql (running c2g under classic). Most of itt works, but now and then when I do a "text items of " decomposition of a mysql text string, I get (unsurprisingly) unicode text where I used to get 'plain' text. OK, just coerce it to "plain text", right? ... well, no ...

given:
   set foo to {}
   set xText to ... (see below)
   tell application "clip2gif"
     set foo to foo&{{position:{50,50},drawn text:xText}}
     set p to save {300,300} as GIF in picture drawing foo
   end tell
   set the clipboard to p

The following string concoctions for xText work... (OSX10.3.7,SE2.0,AS1.9.3)

   "Sample"
   "Sample" as text
   "Sample" as plain text  (compiles to ... as string)

but these fail (the clipboard is empty or invalid, though SE shows a (smallish) PICT object(?) in the result window if you leave off the last script line)

   "Sample" as Unicode text
  ("Sample" as Unicode text) as text
  ("Sample" as Unicode text) as plain text

It seems that coercing "Sample" to Unicode text and back is somehow different from just using "Sample" .. and it isn't clear how I can reliably coerce text fragments to "plain text" that c2g will digest well. Write the thing to disk and read it back in (as someone recently illustrated for a different problem)? Clarifications and suggestions welcome!

 - brian johnson, dept of architecture, university of washington, seattle
_______________________________________________
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


  • Follow-Ups:
    • Re: Text, Unicode Text, and String coercion ...
      • From: Brian Johnson <email@hidden>
    • Re: Text, Unicode Text, and String coercion ...
      • From: Emmanuel <email@hidden>
  • Prev by Date: Internet Connect Script
  • Next by Date: Re: title of window 1 as text
  • Previous by thread: Re: Scripting the GUI in Safari
  • Next by thread: Re: Text, Unicode Text, and String coercion ...
  • Index(es):
    • Date
    • Thread