Some one in the Help Forum wanted to have script to monitor files in a certain directory.
You could write a basic script in AU3 to do that, but it would not be as efficient as using the native WMI functions for this.
$strComputer = "." $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootcimv2") $colMonitoredEvents = $objWMIService.ExecNotificationQuery _ ("SELECT * FROM __InstanceOperationEvent WITHIN 5 WHERE " _ & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _ & "TargetInstance.GroupComponent= " _ & "'Win32_Directory.Name=""c:1""'") While 1 $objEventObject = $colMonitoredEvents.NextEvent() Select Case $objEventObject.Path_.Class()="__InstanceCreationEvent" ConsoleWrite ("A new file was just created: " & $objEventObject.TargetInstance.PartComponent() & @CR) Case $objEventObject.Path_.Class()="__InstanceDeletionEvent" ConsoleWrite ("A file was just deleted: " & $objEventObject.TargetInstance.PartComponent() & @CR) EndSelect WEnd
Create a folder C:1 and add or delete a file in there.
See what happens.
Enjoy !!
ptrex
Edited by ptrex, 14 September 2012 - 09:17 AM.






