Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; 指定のウィンドウ内のボタンをクリック
- Gui, Add, Button, w100, はい(S)
- Gui, Add, Button, wp, ほげ(w)
- Gui, Add, Button, wp, いいえ(N)
- Gui, Show
- Run notepad.exe
- return
- F1::ToolTip % ButtonClick("A", "はい|保存|開く|Yes|OK|Save|Open") ; A=アクティブウィンドウ
- F2::ToolTip % ButtonClick("A", "いいえ|保存しない|キャンセル|No|Cancel")
- F3::ToolTip % ButtonClick("メモ帳 ahk_exe notepad.exe", "はい|保存|開く|Yes|OK|Save|Open")
- F4::ToolTip % ButtonClick("メモ帳 ahk_exe notepad.exe", "いいえ|保存しない|キャンセル|No|Cancel")
- F5::Run notepad.exe
- GuiClose:
- Esc::ExitApp
- ; MGLの場合、関数はユーザー定義サブルーチンに記述 > MouseGestureL\Config\MG_User.ahk
- ButtonClick(WinTitle, ButtonText) { ; ButtonText=正規表現
- if WinActive(WinTitle) {
- WinGet, ClassNN, ControlList
- Loop, Parse, ClassNN, `n
- {
- if (A_LoopField ~= "Button\d+") {
- ControlGetText, Text, %A_LoopField%
- if (Text ~= ButtonText) {
- ControlClick, %A_LoopField%
- return ErrorLevel "`n" WinTitle "`n" A_LoopField "`n" Text
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement