Jump to content

Recommended Posts

Posted

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:

 

 

Posted

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

 

Posted

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

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
  • Recently Browsing   0 members

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