• 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
Strange string test error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange string test error


  • Subject: Strange string test error
  • From: Jeffrey Mattox <email@hidden>
  • Date: Tue, 10 Dec 2002 03:48:07 -0600

In the following code, there are some strings values for theText that cause the if statement to fail -- the "on error" code is executed. theText contains paragraphs from a text file.

set theCount to count of text items in theText
display dialog "Count: " & theCount & " Class: " & (class of theText)
--> Count: 36037 Class: string

try
if (theText is "") then
return false
end if
on error
display dialog "ERROR"
--> ERROR
return false
end try

If, instead of testing for a null string, I test for theCount being equal to zero, then I can accomplish my objective. But I am concerned about why the original test causes an error. How can it cause a script error if theText is a string?

I am using AppleScript Studio and OS 10.2.1.

Jeff
_______________________________________________
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.

  • Prev by Date: Re: Check if it is a number
  • Next by Date: i-cal
  • Previous by thread: Multidimensional arrays of arbitrary complexity
  • Next by thread: Re: Strange string test error
  • Index(es):
    • Date
    • Thread