![]() Please read the code comments to learn how to work around this problem efficiently with a periodic timer and 'dirty' flags. Just run the script, place the script's dialog on a convenient location on the screen, and copy/delete some files on the watched directory with your system's file explorer utility.įileWatcher events are a bit difficult to handle because they are asynchronous. You can change File.systemTempDirectory to other directory of your choice if you wish. Var item = ĭtText( 0, File.extractNameAndSuffix( dirPath ) ) įor ( var i = 0 i \\Temp on Windows). * populated with the contents of the specified dirPath directory. * Recursive routine to explore a directory tree. Return format( "%.*g KiB", precision, bytes/kb ) Return format( "%.*g MiB", precision, bytes/mb ) Return format( "%.*g GiB", precision, bytes/gb ) Return format( "%.*g TiB", precision, bytes/tb ) This.fileSizeAsString = function( bytes, precision ) ![]() * Returns a readable textual representation of a file size in bytes with This.directory_Tree.uniformRowHeight = true This.directory_Tree.rootDecoration = true ![]() This.directory_Tree.numberOfColumns = 3 // name, size, lastModified This.directory_Tree.headerVisible = false This.directory_Tree.alternateRowColor = true This.directory_Tree = new TreeBox( this ) = this // necessary because Timer is not a Control object = this // necessary because FileWatcher is not a Control object See also the comments in updateDirectory(). * may happen while we are updating GUI elements (which are relatively * because FileWatcher events are asynchronous. * always responsive to accumulated FileWatcher events. * We use a periodic timer and a 'dirty' flag to ensure that our dialog is This.dirty = true // flag to signal a pending FileWatcher update event This.busy = false // flag to prevent reentrant FileWatcher events
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |