Jump to content

Stop process if user switches to another account


Recommended Posts

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.  :ph34r:

 

 

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