Created
October 20, 2015 00:08
-
-
Save apsun/7a0901dcfe32ee0f93b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; In order to tack on a layer on abstraction, this script | |
| ; wraps many commonly used AHK commands as functions. | |
| WarningMsgBox(title, message) | |
| { | |
| MsgBox, 48, %title%, %message% | |
| } | |
| InfoMsgBox(title, message) | |
| { | |
| MsgBox, 64, %title%, %message% | |
| } | |
| ErrorMsgBox(title, message) | |
| { | |
| MsgBox, 16, %title%, %message% | |
| } | |
| GetForegroundWindowHandle() | |
| { | |
| return WinExist("A") | |
| } | |
| GetHandleFromClass(className) | |
| { | |
| return WinExist("ahk_class " . className) | |
| } | |
| WaitClassActive(className) | |
| { | |
| WinWaitActive, ahk_class %className% | |
| } | |
| WaitClassNotActive(className) | |
| { | |
| WinWaitNotActive, ahk_class %className% | |
| } | |
| WaitClassExist(className) | |
| { | |
| WinWait, ahk_class %className% | |
| } | |
| WaitClassNotExist(className) | |
| { | |
| WinWaitClose, ahk_class %className% | |
| } | |
| ClassExists(className) | |
| { | |
| return WinExist("ahk_class " . className) != 0 | |
| } | |
| ClassActive(className) | |
| { | |
| return WinActive("ahk_class " . className) != 0 | |
| } | |
| WaitHandleActive(handle) | |
| { | |
| WinWaitActive, ahk_id %handle% | |
| } | |
| WaitHandleNotActive(handle) | |
| { | |
| WinWaitNotActive, ahk_id %handle% | |
| } | |
| WaitHandleNotExist(handle) | |
| { | |
| WinWaitClose, ahk_id %handle% | |
| } | |
| HandleExists(handle) | |
| { | |
| return WinExist("ahk_id " . handle) != 0 | |
| } | |
| HandleActive(handle) | |
| { | |
| return WinActive("ahk_id " . handle) != 0 | |
| } | |
| GetControlText(className, controlClassNN) | |
| { | |
| ControlGetText, ctrlText, %controlClassNN%, ahk_class %className% | |
| return ctrlText | |
| } | |
| ClickControl(className, controlClassNN) | |
| { | |
| oldDelay := A_ControlDelay | |
| SetControlDelay, -1 | |
| ControlClick, %controlClassNN%, ahk_class %className%,,,, NA | |
| SetControlDelay, %oldDelay% | |
| } | |
| FocusControl(className, controlClassNN) | |
| { | |
| ControlFocus, %controlClassNN%, ahk_class %className%,,,, NA | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment