Re: preflighting a file
Re: preflighting a file
- Subject: Re: preflighting a file
- From: Shane Stanley <email@hidden>
- Date: Tue, 19 Feb 2002 19:56:04 +1100
On 19/2/02 6:34 PM +1000, Emmanuel, email@hidden, wrote:
>
At 4:45 AM +0100 19/2/02, Shane Stanley wrote:
>
>
>> set theFile to open for access (choose file)
>
>> set theData to read theFile
>
>> close access theFile
>
>> if "CalGray" is in theData then display dialog "I wouldn't if I were you..."
>
>>
>
>> (Accepting of course that limiting the read command - with something like
>
>> 'for 4024' - might still be required where large files may be involved.)
>
>
>
> As long as theData is never more than 32K, that should work.
>
>
Sorry for probably asking the obvious, but I do not understand what it is
>
that will not work beyond 32K.
>
>
Only the method with the AppleScript's text item delimiters may break for
>
long strings (specially if they are full of "Calgray"'s!).
The "is in" comparison fails with strings greater than 32K. Run this:
set n to 10
set x to "abcdefghijklmnop"
repeat n times
set x to x & x
end repeat
{count of x, "a" is in x}
then change n to 11 and run it again.
Yes?
--
Shane Stanley, email@hidden
_______________________________________________
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.