• 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
Stupid, Stupid Text Features [Was: Can't set creator type]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stupid, Stupid Text Features [Was: Can't set creator type]


  • Subject: Stupid, Stupid Text Features [Was: Can't set creator type]
  • From: Mr Tea <email@hidden>
  • Date: Tue, 24 Feb 2004 10:46:43 +0000

In the original thread, I reported a problem in Panther when using the text returned from a dialog to set the creator type or file type of a file. Basically, it can't be done without first performing a really hairy coercion.

Under Jaguar and earlier, this line...

set theCode to the text returned of dRes

...returned a result that could be used here...

tell application "Finder" to set creator type of f to theCode

...but in Panther, that second line causes a 'data not the expected type' error.


And the data cannot by coerced into usable form with 'as text' (Michelle Steiner's suggestion), 'as string', or by prepending '"" &' to it. The correct method was suggested by Paul Berkowitz, and it involves changing the first line to this...

set theCode to <<class ktxt>> of (text returned of dRes) as record

There. I said it was hairy. Paul is one of the most knowledgeable and experienced contributors on this list, and it's his business to know this kind of stuff, but what about the rest of us!!!???

If this kind of contortionism is required for such a simple procedure, it suggests that AppleScript's text handling is all up the spout, and makes a nonsense of this passage from Matt Neuberg's 'Definitive Guide':

"Unicode text is basically indistinguishable from a string; the differences between them are handled transparently. Whatever you can do to a string, you can do to unicode text." (p 249)

Aside from setting creator and file types, are there any other places where this gotcha is likely to strike?


Nick
pp Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Stupid, Stupid Text Features [Was: Can't set creator type]
      • From: "John W. Baxter" <email@hidden>
    • Re: Stupid, Stupid Text Features [Was: Can't set creator type]
      • From: Paul Berkowitz <email@hidden>
    • Re: Stupid, Stupid Text Features [Was: Can't set creator type]
      • From: Christopher Stone <email@hidden>
    • Re: Stupid, Stupid Text Features [Was: Can't set creator type]
      • From: Walter Ian Kaye <email@hidden>
References: 
 >Can't set creator type (From: Mr Tea <email@hidden>)
 >Re: Can't set creator type (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Can't set creator type
  • Next by Date: Re: on synonyms and homonyms (Re: Efficiently using whose on Address Book users)
  • Previous by thread: Re: Can't set creator type
  • Next by thread: Re: Stupid, Stupid Text Features [Was: Can't set creator type]
  • Index(es):
    • Date
    • Thread