#NoEnv #SingleInstance Force SetTitleMatchMode, 2 SetControlDelay, -1 SetWinDelay, 50 ; ========================================================= ; Cure Please 全ウィンドウ Pause/Paused! 切替(呼び出し即実行版) ; 元の CurePleasePauseAll_Final_fix.ahk から F10 常駐待ちをなくし、 ; 実行された瞬間に1回だけ処理して終了するようにしたもの。 ; FFXI_MenuDual_v4.3.5_CurePleaseOnly.ahk から Run で直接呼び出す。 ; ========================================================= CP_ToggleAllPause() ExitApp CP_GetActiveFFXI() { WinGet, activeId, ID, A if (!activeId) return 0 WinGetClass, cls, ahk_id %activeId% WinGet, proc, ProcessName, ahk_id %activeId% if (cls = "FFXiMainClass" or cls = "FFXiClass" or proc = "pol.exe") return activeId return 0 } CP_GetAnyFFXI() { WinGet, list1, List, ahk_class FFXiMainClass if (list1 >= 1) return list11 WinGet, list2, List, ahk_class FFXiClass if (list2 >= 1) return list21 WinGet, list3, List, ahk_exe pol.exe if (list3 >= 1) return list31 return 0 } CP_RestoreFFXI(targetId) { if (targetId) { IfWinExist, ahk_id %targetId% { WinActivate, ahk_id %targetId% WinWaitActive, ahk_id %targetId%,, 1 return } } fallbackId := CP_GetAnyFFXI() if (fallbackId) { WinActivate, ahk_id %fallbackId% WinWaitActive, ahk_id %fallbackId%,, 1 } } CP_ToggleAllPause() { originalFFXI := CP_GetActiveFFXI() WinGet, idList, List, Cure Please found := 0 clicked := 0 Loop, %idList% { thisId := idList%A_Index% if !thisId continue ; 最小化は除外 WinGet, minmax, MinMax, ahk_id %thisId% if (minmax = -1) continue found++ ok := false ; 本命: 調査ログで見つかった Pause/Paused! の本体ボタン ctrl := "WindowsForms10.BUTTON.app.0.141b42a_r7_ad19" ControlGetText, txt, %ctrl%, ahk_id %thisId% if (txt = "Pause" or txt = "Paused!") { ControlClick, %ctrl%, ahk_id %thisId%, , Left, 1, NA if !ErrorLevel ok := true } ; 念のためフォールバック if (!ok) { WinGet, ctlList, ControlList, ahk_id %thisId% Loop, Parse, ctlList, `n, `r { c := A_LoopField if (c = "") continue ControlGetText, t, %c%, ahk_id %thisId% if (t = "Pause" or t = "Paused!") { ControlClick, %c%, ahk_id %thisId%, , Left, 1, NA if !ErrorLevel { ok := true break } } } } if (ok) clicked++ Sleep, 80 } ; 最後にFF11へ戻す CP_RestoreFFXI(originalFFXI) if (found = 0) { SoundBeep, 800, 120 TrayTip, Cure Please, 開いている Cure Please が見つかりません, 1 return } if (clicked = 0) { SoundBeep, 700, 120 TrayTip, Cure Please, Pause/Paused! ボタンを押せませんでした, 1 return } TrayTip, Cure Please, %clicked% 個の Cure Please で Pause を切り替えました, 1 }