Re: preflighting a file
Re: preflighting a file
- Subject: Re: preflighting a file
- From: Kai Edwards <email@hidden>
- Date: Tue, 19 Feb 2002 19:32:53 +0000
on Tue, 19 Feb 2002 14:45:18 +1100, Shane Stanley
<email@hidden> wrote:
>
On 19/2/02 2:24 PM +1000, Kai Edwards, email@hidden, wrote:
>
> Wouldn't this work?...
>
>
>
> 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.
Right. To be useful on anything but the smallest files, such a script would
clearly need enhancing with something like the 'chunking' techniques
discussed subsequently.
- and on Tue, 19 Feb 2002 16:06:10 +1100, Shane also wrote:
>
OTOH, "offset of" is probably the slowest method, at least OMM (AS 1.8.2b1
>
OS9.2.1). Given a string with the searched-for part in the middle, offset is
>
quicker for strings of a few characters, "is in" is quicker up to near 1000
>
characters, and after that TIDs are fastest. On a string of about 4K, TIDs
>
are nearly twice as fast as "is in", and about 20 times faster than "offset
>
of". As I said, OMM.
Nippy little blighters, those TIDs, eh? No wonder you wheeled them out for
this job ( - he said, frantically searching through some sad old scripts
that needed an extra kick)! :)
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************
_______________________________________________
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.