j_stam_84 0 Posted May 23, 2005 Hi everybody, Would it be possible with AutoIT to set up a global "monitor" and execute a command when opening a random file ? Grtz, JJ Share this post Link to post Share on other sites
scriptkitty 1 Posted May 23, 2005 (edited) set up a loop, and monitor the processlist. when a new process is added, give it a random chance to do something. maybe something like this? $list1=ProcessList() while 1 sleep(5000) $list2 = ProcessList() if $list1[0][0]=$list2[0][0] then else $list1[0][0]=$list2[0][0] if int(random(1,6)=4 then dosomething() endif wend this will also randomly execute when a proccess stops. It is easy to change, just didn't want to do all the work for ya.... side note, this is when they open a random exe, if they just open an additional file in a program already open it wouldn't work. Edited May 23, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Share this post Link to post Share on other sites
j_stam_84 0 Posted May 25, 2005 Hi scriptkiddy! Thanks for your reply Thought of that solution aswell but with that setup, the process would already be running.. and I don't want that I think it has to be something like with the IE example (don't have it here... ); when downloading, you can monitor the progress of the download (via the IE object). grtz, JJ Share this post Link to post Share on other sites
MSLx Fanboy 0 Posted May 25, 2005 (edited) You could enumerate file handles linking to the certain file, and when the filehandle exists in Windows, have it run the function. I don't think AutoIt has it built in natively, however, there's probably a DLL for it already (Microsoft might have one built in )SysInternals has a GUI version to track applications and what files they access FileMon. There might be a CMDLine backend, but it atleast gives you an idea, I hope... Edited May 25, 2005 by MSLx Fanboy Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Share this post Link to post Share on other sites