The Finder Object - ActiveFileFinder Programming Interface

Document Path: Home Page / Programming / ActiveFileFinder / Interfaces / Finder Object  
Properties

PumpWindowMessages

Value BOOL
Access Read, Write
Notes When used in GUI programms such as HTA, set this to true will not blocking the Window messages.

ScanSubDirectories

Value BOOL
Access Read, Write
Notes Whether the 'ScanDirectory', 'CompareDirectory' methods scan sub-directories.
Methods

GetFile

Return Value File object
Arguments:
  • BSTR path

ScanDirectory

Return Value
Arguments:
  • BSTR path
  • Object callbackFunction
Notes
  • Callback Function Protype:
    function ScanDirectoryCallback(finder, flag, file)
    {
    //flag: 0='file' is a file; 1: Begin scanning 'file', which is a directory; -1: End scanning 'file', which is a directory
    //return value: 0: skip this object, 1: continue; -1: abort
    }
    

CompareDirectory

Return Value
Arguments:
  • BSTR path1
  • BSTR path2
  • Object callbackFunction
Notes
  • Callback Function Protype:
    function CompareDirectoryCallback(finder, flag, file1, file2)
    {
    //flag: 0='file' is a file; 1: Begin scanning 'file', which is a directory; -1: End scanning 'file', which is a directory
    //return value: 0: skip this object, 1: continue; -1: abort
    }
    

CreateDirectory

Return Value
Arguments:
  • BSTR path

CopyFile

Return Value
Arguments:
  • BSTR sourcePath
  • BSTR destPath
  • Object progressCallback (Optional, default(0))
Notes
  • Callback Function Protype:
    function CopyFileCallback(finder, progress, total)
    {
    //return value: true: continue; false: abort
    }
    

CompareFile

Return Value ULONG (bit flags, see notes)
Arguments:
  • BSTR file1Path
  • BSTR file2Path
  • BOOL compareContents (Optional, default(0))
  • Object progressCallback (Optional, default(0))
Notes
  • Return value bits:
    CF_NOT_SAME_TYPE=1,
    CF_FILE_1_NOT_EXIST=2,
    CF_FILE_2_NOT_EXIST=4,
    CF_DIFF_SIZE=8,
    CF_DIFF_WTIME=16,
    CF_FILE_1_NEWER=32,
    CF_FAIL_OPEN_FILE_1=64,
    CF_FAIL_OPEN_FILE_2=128,
    CF_DIFF_CONTENTS=256};
    
  • Callback function protype:
    function CompareFileCallback(finder, progress, total)
    {
    //return value: true: continue; false: abort
    }
    

MD5OfFile

Return Value BSTR
Arguments:
  • BSTR path
  • Object progressCallback (Optional, default(0))
Notes
  • Callback function protype:
    function MD5Callback(finder, progress, total)
    {
    //return value: true: continue; false: abort
    }
    

SystemCommand

Return Value System Command Result Object
Arguments:
  • BSTR cmd
  • ULONG timeoutMilliseconds (Optional, default(0xffffffff))
Notes This method executes a Console command without displaying the Console window. The example bellow compare a local directory with a directory on a second computer. The 'NET' command is used to connect to the second computer.
var finder=new ActiveXObject("ActiveFileFinder.Finder");
var info=finder.SystemCommand("net use \\\\smith_notebook /user:smith smithpassword");
if(info.ExitCode==0) //success
{
//do the job
}
finder.SystemCommand("net use \\\\smith_notebook /delete");