It contains only 2 timers, and one hotkey.
However, only one of the timers will work at a time (whichever one is written first in the script). I may have been a bit over-enthusiastic with my 'returns', but I just can't seem to find the problem that's stopping the two timers from working together in the same script.
Can anyone spot the problem?
Code: Select all
ListaryTimer:
SetTimer, HideListarySearchBar, 100
Return
HideListarySearchBar:
IF !WinActive("ahk_class #32770")
Return
IF WinActive("ahk_class #32770")
{
SetTitleMatchMode, RegEx
WinHide ^$ ahk_class Listary_WidgetWin_*
Sleep 5
WinHide ^$ ahk_class Listary_WidgetWin_* ; the command repeated to prevent visible flash of the Listary search bar.
return
}
Return
#IfWinActive ahk_class #32770
^':: ; Ctrl + ' (i.e Ctrl + @ key) toggles the Listary File Dialog search bar on and off.
{ ; Retains last used on/off state. Works fine with the auto-hide timer function above.
SetTitleMatchMode, RegEx
SetTimer, HideListarySearchBar, Off
DetectHiddenWindows, Off
IfWinExist, ^$ ahk_class Listary_WidgetWin_*
GoSub, ListaryTimer
Else
WinShow, ^$ ahk_class Listary_WidgetWin_*
return
}
#If
SetTimer, illustratorChecker, 3000
illustratorChecker:
Process, Exist , illustrator.exe
IF !ErrorLevel
Return
Sleep 500
;MsgBox, illustrator running ; Test line for visually checking when the command is being triggered.
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, Adobe.Illustrator.18\shell, , View
Sleep 2000
SetTimer, illustratorChecker, Off
WinWaitClose, ahk_exe illustrator.exe
SetTimer, illustratorChecker, On
Return