Re: Strange string test error
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.