rcmaehl Posted November 13, 2021 Share Posted November 13, 2021 (edited) Hi all, I'm looking for a way to detect if a new process has been created without running ProcessExists("") in a loop just eating 5% of CPU usage constantly. I need to be able to react quickly, is there any sort of Event Trigger I can make similar to OnEvent()? Edited November 13, 2021 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
JockoDundee Posted November 13, 2021 Share Posted November 13, 2021 Are you looking to detect a particular process that you know the name of, or every new proccess? How quick is quick? Have you no delay in your ProcessExists loop currently? Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
rcmaehl Posted November 13, 2021 Author Share Posted November 13, 2021 (edited) 37 minutes ago, JockoDundee said: Are you looking to detect a particular process that you know the name of, or every new proccess? How quick is quick? Have you no delay in your ProcessExists loop currently? Ideally a new process that I know the name of but whatever but even just for every new process would probably be an improvement over a ProcessExists() loop. Ideally the quicker the better without a constant CPU usage (a ProcessExist loop uses 5-10% CPU constantly on my system). The issue I'm experiencing is that if Microsoft Edge is already open and you run microsoft-edge:https://google.com you only have a small period of time before the command line parameters containing the URI are lost. (Checkable using Get-WmiObject Win32_Process -Filter "name = 'msedge.exe'" | Select-Object CommandLine | Format-Table -Wrap -AutoSize | Out-File ./edge.txt in powershell) This doesn't occur with new Microsoft Edge windows, just ones Edge converts from a potential new window to a tab. Edited November 13, 2021 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
jguinch Posted November 13, 2021 Share Posted November 13, 2021 Look at this one : rcmaehl 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
rcmaehl Posted November 14, 2021 Author Share Posted November 14, 2021 (edited) 6 hours ago, jguinch said: Look at this one : WM_SHELLHOOK didn't work for me as the process had been running for a bit before it even created the window IRONICALLY, Running ProcessExists ~140 times a second is SIGNIFICANTLY more lightweight than polling WMI 100 times a second. Edited November 14, 2021 by rcmaehl My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
Werty Posted November 14, 2021 Share Posted November 14, 2021 Does it have to poll that often? in Kylomas WMI example the interval is set at 0.1, have you tried fiddling with it, maybe 2.0? Also, I dont know if it applies to this, but trancexx suggested to someone about using "volatile" together with an _On ObjEvent, in this thread. https://www.autoitscript.com/forum/topic/199074-objevent-issue/?tab=comments#comment-1428487 Some guy's script + some other guy's script = my script! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now