[futurebasic] Re: [FB] Set filetype, creatortype

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2004 : Group Archive : Group : All Groups

From: Bernie Wylde <bernie.w@...>
Date: Fri, 7 May 2004 10:13:15 +0100
On 6 May 2004, at 15:10, michael evans wrote:

> Hello all
> In subs files.incl there is a function:
> <code snip>
> If I want to set a file to be a photoshop jpeg file then
> FType& = _"JPEG" and CType& = _"8BIM"

Michael,

QuiXample found this AP function.

HIH
:-b

'-----
clear local mode
local fn SetTypeAndCreator(fSpec as .FSSpec, type as OSType, creator as 
OSType)//Alain
dim err as OSErr
dim pb.80

pb.ioNamePtr& = @fSpec.name
pb.ioVRefNum% = fSpec.vRefNum
pb.ioDirID&   = fSpec.parID

#if CarbonLib = 0
   err = fn GetFileInfo (pb)
#else
   err = fn PBHGetFInfoSync (pb)
#EndIf

  long if (err = 0)
   pb.ioFlUsrWds.fdCreator& = creator
   pb.ioFlUsrWds.fdType&    = type
   // addition below
   pb.ioNamePtr& = @fSpec.name
   pb.ioVRefNum% = fSpec.vRefNum
   pb.ioDirID&   = fSpec.parID
   #if CarbonLib = 0
     err = fn SetFileInfo (pb)
   #else
     err = fn PBHSetFInfoSync (pb)
   #Endif
end If
end fn = err

dim f as FSSpec

long if len(files$(_FSSpecOpen,"","",f))
fn SetTypeAndCreator(f,_"TEXT",_"FB^e")
end if

do
HandleEvents
until _nil
'-----