• 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
Looking for Specific Bytes in a File
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Looking for Specific Bytes in a File


  • Subject: Looking for Specific Bytes in a File
  • From: Marconi <email@hidden>
  • Date: Fri, 13 Feb 2004 11:38:57 -0700

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? Would it be better (faster) to search for '11' (or the ASCII thereof) first, then see if the next byte is '08'? Or would the difference be negligible?

Advice?




--
Good intentions will always be pleaded for any assumption of power. The Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters. -- Daniel Webster
_______________________________________________
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: Looking for Specific Bytes in a File
      • From: Graff <email@hidden>
    • Re: Looking for Specific Bytes in a File
      • From: Graff <email@hidden>
    • Re: Looking for Specific Bytes in a File
      • From: Graff <email@hidden>
    • Re: Looking for Specific Bytes in a File
      • From: Andrew Oliver <email@hidden>
    • Re: Looking for Specific Bytes in a File
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: do shell script
  • Next by Date: Re: Looking for Specific Bytes in a File
  • Previous by thread: Select focus for GUI script
  • Next by thread: Re: Looking for Specific Bytes in a File
  • Index(es):
    • Date
    • Thread