• 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
Re: When Is A String Not A String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When Is A String Not A String


  • Subject: Re: When Is A String Not A String
  • From: Luther Fuller <email@hidden>
  • Date: Mon, 11 Aug 2008 13:10:17 -0500

On Aug 11, 2008, at 12:46 PM, email@hidden wrote:
At 11:29 AM -0500 8/11/08, Luther Fuller wrote:
I have a variable, x, which is either a string or an alias to a folder. When x encounters this code ...

	if (class of x) is string then
		A
	else -- x is an alias
		B
	end if

... it works perfectly in Leopard. But, I've just discovered, not in Tiger 10.4.11.

In Tiger, if x = "a text message" (which is certainly a string), then block A is skipped and block B runs with an error message containing "a text message". (Which is certainly impossible.)

Who knows what's happening here?

Me!

To be safe, use the trilogy:

if (class of x) is in {Unicode text, text, string} then

Your string is probably Unicode text, while for Tiger "text" means good old 8-bit MacRoman.

My original code said something like ...

	, x:"a text message",

In Leopard, this returns class 'text', but in Tiger it returns class 'Unicode text'.
(That's what my diagnostic message said!)


I've just changed my code to ...

	, x:"a text message" as text,

In Leopard, this still returns class 'text', but in Tiger it now returns class 'string'.
My code now works properly in both Leopard and Tiger.















_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >When Is A String Not A String (From: Luther Fuller <email@hidden>)
 >Re: When Is A String Not A String (From: email@hidden)

  • Prev by Date: Re: When Is A String Not A String
  • Next by Date: full screen for screen sharing
  • Previous by thread: Re: When Is A String Not A String
  • Next by thread: full screen for screen sharing
  • Index(es):
    • Date
    • Thread