Re: Looking for Specific Bytes in a File
Re: Looking for Specific Bytes in a File
- Subject: Re: Looking for Specific Bytes in a File
- From: Emmanuel <email@hidden>
- Date: Fri, 13 Feb 2004 19:51:05 +0100
At 11:38 AM -0700 2/13/04, Marconi wrote:
>
I'm trying to open the data fork of a file and find the first occurrence of the hex bytes '1108' then grab the following four bytes and return them as two decimal values.
>
>
What I'm doing:
>
In a JPEG image file, it appears that the image width is in the two bytes following '1108' and the image height is the next two bytes after the width. These do not occur at a consistent offset. I'm intending on scripting some actions that depend on the dimensions of the JPEG image dropped onto the droplet script.
>
>
I'm uncertain how to 'crawl' a file looking for that first '1108'. Should I convert 1108 to ASCII and search for that?
Why not.
----------------------- untested
set thejpeg to read f
set theoffset to offset of ((ASCII character of 11) & (ASCII character of 8)) in thejpeg
-----------------------
Emmanuel
_______________________________________________
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.