26
Post New Requests Here / Re: IDEA: Send keystroke/run program unless key pressed (repeatedly) within n sec
« on: June 08, 2009, 03:12 AM »
Do you have autohotkey installed?
if so you can try this script.
It's just a rough draught so you can test & see if this is what you have in mind.
This script has a timeout of 60 secs & you can press Win+3 to reset the timer.
The setting are the variables at the top of the file - they are obviously named.
Right now the script just runs once & if it locks you out you will have to run the script again - but as I said it's just a first run.
And hopefully sum other guys here will jump in 2 polish it up.
if so you can try this script.
It's just a rough draught so you can test & see if this is what you have in mind.
This script has a timeout of 60 secs & you can press Win+3 to reset the timer.
The setting are the variables at the top of the file - they are obviously named.
Right now the script just runs once & if it locks you out you will have to run the script again - but as I said it's just a first run.
And hopefully sum other guys here will jump in 2 polish it up.
#Persistent
#SingleInstance force
#UseHook On
#Include %A_ScriptDir%
SetWorkingDir, %A_ScriptDir%
HotkeyCombo = #3
CountdownTimer = 60
WarningMessageTimer = 30
WarningMessage = WiFi connection signal quality is poor, connection will be lost in %WarningMessageTimer% seconds
DebugMode := False
StartUp:
{
nCountdownTimer := 1000 * CountdownTimer
nWarningTimer := 1000 * WarningMessageTimer
nInternalTimer := nCountdownTimer
nInternalTimerResolution := 100
bIconOff := False
if(WarningMessageTimer>CountdownTimer)
{
msgbox "CountdownTimer" must be greater than or equal to "WarningMessageTimer"
return
}
Hotkey, %HotkeyCombo%, HotkeyPressed
SetTimer, InternalTimer, %nInternalTimerResolution%
return
}
HotkeyPressed:
{
SetTimer, InternalTimer, Off
nInternalTimer := nCountdownTimer
SetTimer, InternalTimer, %nInternalTimerResolution%
TrayTip, Autolock, Timer reset thank you, 5
return
}
InternalTimer:
{
nInternalTimer := nInternalTimer - nInternalTimerResolution
if(nInternalTimer<=0)
{
Gosub, LockOut
return
}
if(nInternalTimer<=nWarningTimer)
{
Gosub, ShowWarning
return
}
bIconOff := !bIconOff
if(bIconOff)
{
Menu, Tray, Icon, Shell32.dll, 174
}
else
{
Menu, Tray, Icon, Shell32.dll, 173
}
return
}
ShowWarning:
{
TrayTip, Autolock, %WarningMessage%, 30
return
}
LockOut:
{
SetTimer, InternalTimer, Off
if(DebugMode)
{
msgbox, LOCKOUT
}
else
{
DllCall("LockWorkStation")
}
return
}