[futurebasic] The Files Invisibule

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 1999 : Group Archive : Group : All Groups

From: John Clark <ArtVandals@...>
Date: Sun, 7 Mar 1999 23:57:03 +1100
Hi All,

Using some routines cobbled together from some FN's from FJll and Files 
in a Folder (Waverly?) I am trying to loop through a series of folders 
and make visible any files which are invisible. Then I am intending to 
move them somewhere else using the FJll move file function.

The problem which I do not understand is that the paramblock pBlock, 
seems to be filled with the file name etc by the first part of the 
function. But when I use this to check the invisibility, I get a file not 
found error (-43).

I tried doing another FN GETCATINFO(@pBlock) to check the pblock but 
similarly get another -43 error.

Any clues?

CLEAR LOCAL
DIM pBlock.128,fileIndex%
DIM fileName$,FolderName$
DIM FileInFolder$,Depth$ 
DIM fdFlags%
DIM osErr%,EF&,cursRsrcID,fRef%
LOCAL FN makeFileList(vRefNum%,DirID&,Indent%)
  cursRsrcID = 128                                            ' 'Set the 
initial cursor ID
  EF& = WINDOW(_efHandle)                                     ' 'get the 
edit field handle if it exists
  fileIndex% = 1                                              ' 'set the 
initial file index
  pBlock.IoNamePtr& = @fileName$                              ' 'set the 
name ptr to a variable pointer
  pBlock.IovRefNum% = vRefNum%                                ' 'set the 
initial volume reference number
  DO 
    DEF CYCLE (_FirstCursor,_LastCursor,cursRsrcID)           ' 'cycle 
the cursor ID
    CURSOR cursRsrcID                                         ' 'change 
cursor. Effect reduces perceived processing time
    '
    'TRON x  'allow user to break loop (optional) - Function will speed 
up if taken out
    pBlock.ioDirID& = DirID&                                  ' 'set the 
Directory ID
    pBlock.Iofdirindex% = fileIndex%                          ' 'set the 
files index
    osErr% = FN GETCATINFO(@pBlock)                           ' 'fill 
parameter block
    LONG IF FN BITTST (pBlock.ioFlAttrib%,_kFolderBit )       ' 'test to 
see if dealing with a folder
      LONG IF osErr% = _false                                 ' 'only do 
work if there is no error
        Depth$ = SPACE$(Indent% * 2)                          ' 'indent 
spaces if folder
        FolderName$ = Depth$ + fileName$ + ": " + CHR$(215) + CHR$(13)' 
'mark folders for easier identification
        CALL TEINSERT(@FolderName$+1,LEN(FolderName$),EF&)
        
        FN makeFileList(vRefNum%,pBlock.ioDirID&,Indent% + 1)' 'recurse 
if a new folder
      END IF
    XELSE
      LONG IF osErr% = _false                                 ' 'Always 
check for errors!
        IF Indent% > 0 THEN Depth$ = SPACE$((Indent% * 2) + 2)' 'if not a 
root folder file then indent to show depth
        FileInFolder$ = Depth$ + fileName$ + CHR$(13)
        CALL TEINSERT(@FileInFolder$+1,LEN(FileInFolder$),EF&)' 'display 
filename

'Stops working here!  osErr returns -43, does not exist, or file not found

        'osErr% = FN GETCATINFO(@pBlock)                       ' 'fill 
parameter block
        LONG IF osErr% = _noErr
          fdFlags% = pBlock.ioBuffer.fdFlags%
          LONG IF hide%                                       ' make it 
invisible
            fdFlags% = fdFlags% OR 16384                      ' set bit 14
          XELSE
            fdFlags% = fdFlags% AND &X1011111111111111        ' clear bit 
14
          END IF
          pBlock.ioBuffer.fdFlags% = fdFlags%
        END IF
        osErr% = FN SETCATINFO(@pBlock)
        
        'FN hideFile(fileName$,pBlock.IovRefNum%,_false)       ' Make 
Visbule
      END IF
    END IF
    INC (fileIndex%)                                          ' 
'increment the file index
  UNTIL osErr%                                                ' 'do until 
there no more folders or files
END FN






==========================================================================
John Clark                    
Aeronaut Automation
30 Kennedy Place Bayview 2104 Australia
Phone:   61 2 99 97 28 42              Fax: 61 2 99 79 56 15
email:   JohnC@...
http://www.AeronautAuto.com
==========================================================================