Jump to content

Run command on file execution


Recommended Posts

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

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
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).

grtz,

JJ

Link to comment
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())
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...