• 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: julifos <email@hidden>
  • Date: Wed, 11 Dec 2002 09:24:19 +0000

> 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
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
_______________________________________________
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: Jeffrey Mattox <email@hidden>
  • Prev by Date: Re: GraphicConverter & saving files in new places
  • Next by Date: Re: Variables inside handlers
  • Previous by thread: Strange string test error
  • Next by thread: Re: Strange string test error
  • Index(es):
    • Date
    • Thread