Sign in to follow this  
Followers 0
WhatDoYouSee

Help whit countdown inactivity scrip

6 posts in this topic

#1 ·  Posted (edited)

Hello, I need help with an important script that I'm doing, steal the forum this script, I would like to do that if the countdown is on 0 run a program, but is restarted to 1 minute when the user moves the mouse
 
sorry for not handling the most of the English.
 
Hola, necesito ayuda con un script importante que estoy haciendo, robé del foro este script, me gustaría hacer que si el countdown esté en 0 ejecute un programa, pero que se reinicie el contador a 1 minuto cuando el usuario mueve el mouse
 
disculpen no manejo al máximo el ingles.
#include <WindowsConstants.au3>

Global $SS_CENTER, $_CompteArebour = 60000, $_Minutes, $_Seconds

$_GuiCountDown = GUICreate ( "CountDown...", 500, 200, @DesktopWidth/2 -250, @DesktopHeight/2 -100, $WS_EX_TOPMOST  )
GUISetBkColor ( 0xFFFF00 )
$TimeLabel = GUICtrlCreateLabel ( "", 35, -10, 480, 180, $SS_CENTER )
GUICtrlSetFont ( -1, 125, 800 )
GUISetState ( )
WinSetOnTop ( $_GuiCountDown, "", 1 )
$TimeTicks = TimerInit ( )

While 1
    _Check ( )
    Sleep ( 200 )
WEnd

Func _Check ( )
    $_CompteArebour -= TimerDiff ( $TimeTicks )
    $TimeTicks = TimerInit ( )
    Local $_MinCalc = Int ( $_CompteArebour / ( 60 * 1000 ) ), $_SecCalc = $_CompteArebour - ( $_MinCalc * 60 * 1000 )
    $_SecCalc = Int ( $_SecCalc / 1000 )
    If $_MinCalc <= 0 And $_SecCalc <= 0 Then
        GUISetBkColor ( 0xFF0000, $_GuiCountDown )
        GUICtrlSetData ( $TimeLabel, "Bye !" )
        Sleep ( 1000 )
        ; If @Compiled Then Shutdown ( 13 )
        Exit
    Else
        If $_MinCalc <> $_Minutes Or $_SecCalc <> $_Seconds Then
            $_Minutes = $_MinCalc
            $_Seconds = $_SecCalc
            GUICtrlSetData ( $TimeLabel, StringFormat ( "%02u" & ":" & "%02u", $_Minutes, $_Seconds ) )
            If $_Minutes = 0 And $_Seconds <= 10 Then
                Beep ( 1200, 100 )
                GUISetBkColor ( 0xA093FF, $_GuiCountDown )
            EndIf
        EndIf
    EndIf
EndFunc ;==> _Check ( )

 

Edited by WhatDoYouSee

Share this post


Link to post
Share on other sites



For what it's worth, I post this code, made to be a screen saver, reverting to a Library kid's computer menu screen after a time out for non-activity. It could help you with your script. I apologize to the forum member (probably Melba23 or BrewManNH, but possibly others) for not acknowledging your significant contributions, but if you contact me, I'll put the appropriate acknowledgment in the script.

This code works great, with a one minute counter until the msgbox requires user response.

#include <Timers.au3>

Sleep (60 * 1000) ;delay for bootup

$t = 1

; Mouse/Keyboard action during the following 60 sec delay will restart the timer

While $t = 1

Sleep(60 * 1000); 60 seconds loop time

$MenuActive = WinActive ("Forsyth County Public Library") ; the name of the menu screen

If $MenuActive <> 0 Then

Sleep(30 * 1000)

Else

Global $iIdleTime = _Timer_GetIdleTime()

If $iIdleTime > 60000 Then; 1 minute

$response = MsgBox (0, "Are You Still There?", "Click OK to continue using this computer.", 15)

WinActivate ("Are You Still There?")

If $response = -1 Then

Local $processarray[6]

$processarray[0] = "BAILEY.exe"

$processarray[1] = "MILLIE.exe"

$processarray[2] = "iexplore.exe"

$processarray[3] = "SAMMY.exe"

$processarray[4] = "Jungle.exe"

$processarray[5] = "TRUDY.exe"

Local $i

For $i = 0 to 5

If ProcessExists ($processarray[$i]) <> 0 then

ProcessClose ($processarray[$i])

EndIf

Next

EndIf

EndIf

EndIf

WEnd

Note: my "Code" button isn't working, so it seems. Apologies there, and if anyone recognizes the code, and would like me to acknowledge the author, I am more than willing. It's rude not to give credit where it's due.

_aleph_


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites

For what it's worth, I post this code, made to be a screen saver, reverting to a Library kid's computer menu screen after a time out for non-activity. It could help you with your script. I apologize to the forum member (probably Melba23 or BrewManNH, but possibly others) for not acknowledging your significant contributions, but if you contact me, I'll put the appropriate acknowledgment in the script.

This code works great, with a one minute counter until the msgbox requires user response.

#include <Timers.au3>

Sleep (60 * 1000) ;delay for bootup

$t = 1

; Mouse/Keyboard action during the following 60 sec delay will restart the timer

While $t = 1

Sleep(60 * 1000); 60 seconds loop time

$MenuActive = WinActive ("Forsyth County Public Library") ; the name of the menu screen

If $MenuActive <> 0 Then

Sleep(30 * 1000)

Else

Global $iIdleTime = _Timer_GetIdleTime()

If $iIdleTime > 60000 Then; 1 minute

$response = MsgBox (0, "Are You Still There?", "Click OK to continue using this computer.", 15)

WinActivate ("Are You Still There?")

If $response = -1 Then

Local $processarray[6]

$processarray[0] = "BAILEY.exe"

$processarray[1] = "MILLIE.exe"

$processarray[2] = "iexplore.exe"

$processarray[3] = "SAMMY.exe"

$processarray[4] = "Jungle.exe"

$processarray[5] = "TRUDY.exe"

Local $i

For $i = 0 to 5

If ProcessExists ($processarray[$i]) <> 0 then

ProcessClose ($processarray[$i])

EndIf

Next

EndIf

EndIf

EndIf

WEnd

Note: my "Code" button isn't working, so it seems. Apologies there, and if anyone recognizes the code, and would like me to acknowledge the author, I am more than willing. It's rude not to give credit where it's due.

_aleph_

Ty men you are a nice guy =)

Share this post


Link to post
Share on other sites

Where do I can insert the program run, I need before pressing OK?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

W.D.Y.S.,

aleph01 posted an example for you to use, not a runnable solution.

Some questions:

  Do you have the full SCiTE package installed?

  Do you want to detect keyboard activity as well as mouse movement?

  Is the initial timer 1 minute or something else?

  What do yo want to do after you run the program?

  Do you want to allow multiple instances of the program that you run when the timer expires?

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

yes, yes, mouse and keyboard, 1 minute countdown, reset time when move mouse or press key, when the countdown stay in 0 seconds go to press keys (ctrl+k coldown 1 sec ctrl+j), repeat all this infinite times.

Edited by WhatDoYouSee

Share this post


Link to post
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
Sign in to follow this  
Followers 0