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

Re: Strange string test error


  • Subject: Re: Strange string test error
  • From: Jeffrey Mattox <email@hidden>
  • Date: Wed, 11 Dec 2002 11:42:55 -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?

This code shouldn't return an error never, unless "theText" is an undefined
variable...

Perhaps (?) theText is an undefined variable or some labeled object within
your project? I think the best way to debug an error is know the error ;-)
Why don't you handle the error properly, so we can see what is it?

try

...

on error x
display dialog x
end

JJ

Good idea. The error is:

Can't perform operation on text longer than 32K bytes.

Scary!

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.

  • Follow-Ups:
    • Re: Strange string test error
      • From: julifos <email@hidden>
References: 
 >Re: Strange string test error (From: julifos <email@hidden>)

  • Prev by Date: Re: Stuck trying to use creatorid to control IE
  • Next by Date: Re: Variables inside handlers
  • Previous by thread: Re: Strange string test error
  • Next by thread: Re: Strange string test error
  • Index(es):
    • Date
    • Thread