electrolux Posted May 9, 2018 Share Posted May 9, 2018 I am trying to write a script for my PC which starts a Monero miner when the user is absent. I have gotten this far and the script is working as intended except for one thing: #include <Timers.au3> While 1 Sleep(10) $idleTimer = _Timer_GetIdleTime() If $idleTimer > 3000 And Not ProcessExists("xmr-stak.exe") Then Run("C:\Users\user\Documents\xmr-stak-win64/xmr-stak.exe") ElseIf $idleTimer < 10 Then ProcessClose("xmr-stak.exe") EndIf WEnd The issue is Switch user is often used as it's a family PC and when someone switches to a different account to which the script is running the script detects the user idle and starts the miner. Is this a limitation with idletimer or can I do something about it? This is my first time using Autoit or doing programming of any kind so please excuse my noobness. Link to comment Share on other sites More sharing options...
Earthshine Posted May 9, 2018 Share Posted May 9, 2018 you will need to be able to detect user switches. I found this. in that post he gets it working. You can use that code if it works for you or adapt it to your needs. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
electrolux Posted May 9, 2018 Author Share Posted May 9, 2018 Thanks for the reply but I managed to get it working through Task scheduler. I compiled a new script which kills all the necessary processes and set it to trigger on user disconnecting from session in Task Scheduler. Seems to work seamlessly. Earthshine 1 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