Hi everyppl,
I know this idea is floating around on the boards but I haven't been able to get it working properly.
Basically, I have 2 text windows open - one I want to type into all the time, and one I want to type in for short periods of time.
EG: Dreamweaver and an IM chat.
I want to be able to have the main window (dreamweaver) under focus by default, but I want to be able to click in the chatbox (or any other) and for as long as I am typing there it keeps focus. After an extended period of non-activity (eg, no more typing, say, 5~8 seconds) I want to switch back to the main window (returning to work)
The following code
almost does what I want, except for the "keep focus while I am typing" part.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance, force
#Persistent
#WinActivateForce
SetTitleMatchMode, 2
Inputbox, name, Program to focus, Type the name of the program to keep in focus:, , 250, 150
if name = ; If nothing is entered for the app name exit script
{
exitapp
}
Inputbox, time, How long to wait, How long should I wait before reactivating? (milliseconds):, , 250, 150
If time =
{
time := 5000
}
SetTimer, WatchWindow, %time%
return
WatchWindow:
IfWinActive, %name%
{
return
}
Else
{
Sleep 5000
;some if-key-pressed-reset-sleep-timer code
WinActivate, %name%
}
Return
Thanks in advance