Jump to content
Sign in to follow this  

Run command on file execution

Recommended Posts

Hi everybody,

Would it be possible with AutoIT to set up a global "monitor" and execute a command when opening a random file ?



Share this post

Link to post
Share on other sites

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?

while 1
$list2 = ProcessList()
if $list1[0][0]=$list2[0][0] then
     if int(random(1,6)=4 then dosomething()


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 by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post

Link to post
Share on other sites

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).



Share this post

Link to post
Share on other sites

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 by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...