Re insert file type and creator
JimAultWins at yahoo.com
Tue Jul 29 03:48:55 CDT 2008
A couple of Applescript tips and a working script
 Remember, File type and creator codes are always 4 characters long.
 The Finder uses an indirect syntax to refer to a file on the hard drive
as string =>
"Macintosh HD:Users:sivakatirswami:Desktop:_temp:a tst creator:image.tiff"
as alias =>
Finder does a check to see if the file name (expressed as a string) can
actually be resolved to a valid file on the hard drive. If so, the 'alias'
becomes a valid reference.
------- copy this code into Script Editor and click Run
--user gets to choose
set theFileAlias to choose file
set theFileStr to (theFileAlias as string)
set theNewAliasRef to (theFileStr as alias)
set theBadFileStr to (theFileStr & "junk")
set theFlawedAliasRef to (theBadFileStr as alias)
-->oops without the 'try'
-- you get an error dialog that the file could not be found
--- and it aborts the script
-- error could be bad file name, file permissions, etc.
--note the variations
set theOutputStr to (theFileAlias & return & theFileStr & return &
theNewAliasRef & return & theFileAlias & return & theBadFileStr) as list
------ end copy
Hope this gets you up and running
On 7/28/08 9:28 PM, "Sivakatirswami" <katir at hindu.org> wrote:
> J. Landman Gay wrote:
>> Sivakatirswami wrote:
>>> semi urgent...
>>> Recent upgrade on the fab photo processing tool DXO got us in trouble
>>> because it's outputting .tiff files with no resource fork and
>>> dropping the creator and type on OSX 10.5.4
>>> The pre-press team is asking me if i can write a widget to poke TIFF
>>> and 8BIM back into the type and creator slots of the resource fork...
>>> Anyone know if we can do this in revolution?
>> You've probably already done this with the AppleScript solution, but
>> for future reference, you can set a Mac file type using the "filetype"
>> property. So all you'd need to do is something like this:
>> set the filetype to "????TIFF"
>> put url ("binfile:myfile") into url ("binfile:myNewFile")
>> Just for the record, if you are trying to set a file type on stacks,
>> you need to use the "stackfiletype" instead.
> I saw the docs on setting the filetype as an environment global before
> writing, andyes:
> global gCTCPath
> on mouseUp
> put fld "Listing" into tFiles
> repeat for each line x in tFiles
> put gCTCPath &"/"& (item 1 of x) into tFile
> set the filetype to "8BIMTIFF"
> put url ("binfile:"&tFile) into url ("binfile:"&tFile&"-1")
> end repeat
> end mouseUp
> works fine. But we prefer to avoid copying these files (some are huge)
> if possible
> For the applescript solution, my rev code is working but not my
> applescript (there is no "the" in the
> syntax, which i found on the web:)
> My script builds this script which should work (I always test in
> Applescript itself...)
> tell application "Finder"
> set creator type of "Macintosh HD:Users:sivakatirswami:Desktop:_temp:a
> tst creator:image.tiff" to "8BIM"
> set file type of "Macintosh HD:Users:sivakatirswami:Desktop:_temp:a tst
> creator:image.tiff" to "8BIM"
> end tell
> generates an error:
> Can¹t set «class fcrt» of "Macintosh
> HD:Users:sivakatirswami:Desktop:_temp:a tst creator:image.tiff" to "8BIM".
> And since I don't have a clue what "class fcrt" means... I'm stuck.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
More information about the use-livecode