ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Coding Snacks

IDEA: focus get (and keep, for a while)

<< < (2/2)

skrommel:
 :) Try ReFocus!

- Refocuses a window after 5 seconds of inactivity.
- Press F1 to change the window to refocus.

Skrommel


--- ---;ReFocus.ahk
; Refocuses a window after 5 seconds of inactivity.
; Press F1 to change the window to refocus.
;Skrommel @ 2008

idletime=5000
focus:=WinExist("Notepad")

#SingleInstance,Force
#NoEnv
SetWinDelay,0

applicationname=ReFocus

SetTimer,TIMER,1000

TrayTip,%applicationname%,- Refocuses a window after 5 seconds of inactivity.`n- Press F1 to change the window to refocus.
Return

F1::
focus:=WinExist("A")
WinGetActiveTitle,title
TrayTip,%applicationname%,%title%
Return


TIMER:
IfWinNotActive,ahk_id %focus%
If (A_TimeIdlePhysical>idletime)
  WinActivate,ahk_id %focus%
Return

urlwolf:
And skrommel is back into action!

bft_chromeguy:
oh wow!! I never knew it would be as easy as "A_TimeIdlePhysical"
I seriously gotta delve into the docs a bit more for AHK...
skrommel, you are my hero  :Thmbsup:

Navigation

[0] Message Index

[*] Previous page

Go to full version