ScanDirectory Callback

Document Path: Home Page / Command Tools / SyncScan / ScanDirectory Callback  

The ScanDirectory method of the App object calls this Callback function:

Callback Function Protype
function ScanCallback(directory_Flag, file_Object)
{

}
directory_Flag
Return value
Sample Callback Function
function ScanCallback(dirFlag, fo)
{
    switch(dirFlag)
    {
    case 2:
        app.Print("\nStart scanning " + fo.FullPath+"\n");
    case -2:
       app.Print("\nFinished scanning " + fo.FullPath+"\n");
        break;
    case 0:
       app.Print("File: " + fo.FullPath + "\n");
        break;
    case 1:
        app.Print("Begin scanning sub-directory "+fo.FullPath+"\n");
        break;
    case -1:
        app.Print("End of scanning sub-directory "+fo.FullPath+"\n");
        break;
    }

    if(app.kbhit()) //user pressed a key?
    {
        var ch=app.getch(); //Read the key without displaying it
        if(ch==27) //If the key is ESC
        {
            app.Print("*** Abort ***\n");
            return(-1); 
        }
    }
}