Jump to content

stop if user is active


Recommended Posts

situation:

i want the script to stop running when i am active, and start when i am not.

problem:

i found help with making it start when i am not active. but not to stop when i am.

my script:

AdLibEnable("_UpdateTimer", 100)

Global $nTimer = 0

Global $OldMousePosition = MouseGetPos()

GLobal $NewMousePosition

While(1)

sleep(10)

WEnd

Func _UpdateTimer()

$nTimer += 100 ;100 ms

$NewMousePosition = MouseGetPos()

if (($NewMousePosition[0] == $OldMousePosition[0]) and ($NewMousePosition[1] == $OldMousePosition[1])) Then

; The user is still idle (you might also want to check for key presses

Else

; The user moved, we should start the timer over.

$OldMousePosition = $NewMousePosition

$nTimer = 0

EndIf

if ($nTimer >= 5000) Then ;Change the '5000' to the number in milliseconds you want to wait, with your user being idle.

_OnTimerFinish()

$nTimer = 0

EndIf

EndFunc

Func _OnTimerFinish()

run ("photoshoppiceditV4.exe")

EndFunc

<--a good way to start you day
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...