; Activate the specified window/dialog whenever it appears ; http://www.donationcoder.com/Forums/bb/index.php?topic=22730.0 ; Last Updated: 29/05/2010 12:59:07 PM #Persistent #SingleInstance force #NoEnv ;#NoTrayIcon SetBatchLines, -1 SetTitleMatchMode, 2 ; partial title match SetWorkingDir, %A_ScriptDir% DetectHiddenWindows, Off ; they are hidden for a reason.. Gosub, Get_INI ; go to INI section IfExist, %TrayIcon% ;TrayMenu Customisation Menu, Tray, Icon, %TrayIcon% Menu, Tray, Tip, Activate the specified window/dialog whenever it appears. SetTimer, ActivateMe, 500 ; timer starts - increase or decrease the value as necessary Return ActivateMe: ;parse and auto-activate Loop, Parse, WatchThese, | { IfWinExist %A_LoopField% { WinActivate ;do something here like press the ok button ;ControlClick, OK ;sleep for a while - good for cpu cycle Sleep, 2000 } } Return Get_INI: If (!FileExist("ActivateDialogs.ini")) { FileAppend, [Settings]`nWatchThese=File has changed ahk_class #32770|Open ahk_class #32770`nTrayIcon=c:\path\to\IconsName.ico, ActivateDialogs.ini } IniRead,WatchThese,ActivateDialogs.ini,Settings,WatchThese IniRead,TrayIcon,ActivateDialogs.ini,Settings,TrayIcon Return