Many of my scripts include a block that reads the first eight bytes of a file in order to decide what to do with the file. This is a simplified version:
on open theDrop set dropItem to (item 1 of theDrop) set isWPDoc to false set isWPDoc to ((read file (dropItem as text) from 1 to 4 as data) is «data rdatFF575043») end open
I’m revising my scripts to use more recent technologies, and if I add these lines to the top:
use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions use framework "Foundation"
then the script fails on the third “set” line with the error “Can’t make current application into type file” - which completely baffles me.
Is there some way I can read the first eight bytes of a file without producing this error, while still using current technologies?