Quick Tetris

因為懶得動滑鼠按按鈕,故寫AHK用鍵盤按
目前功能如下:
  • W鍵,自動置中視窗
  • S鍵,Start (Sprint、2P)
  • A鍵,Play Again (Sprint、2P)
  • R鍵,Restart (Sprint)

#IfWinActive ahk_class Chrome_WidgetWin_1
$W::ResizeWin(1075,1052)

;Sprint Restart
#IfWinActive ahk_class Chrome_WidgetWin_1, Tetris Sprint
$R::
Send {Esc}
ControlClick, x710 y570
Return

;Sprint Play Again
#IfWinActive ahk_class Chrome_WidgetWin_1, Tetris Sprint
$A::ControlClick, x258 y558

;Sprint Start
#IfWinActive ahk_class Chrome_WidgetWin_1, Tetris Sprint
$S::ControlClick, x722 y503

;2P Start
#IfWinActive ahk_class Chrome_WidgetWin_1, Battle 2P
$S::ControlClick, x332 y345

;2P Play Again
#IfWinActive ahk_class Chrome_WidgetWin_1, Battle 2P
$A::ControlClick, x258 y560

ResizeWin(Width = 0,Height = 0)
{
    WinGetPos,X,Y,W,H,A
    If %Width% = 0
        Width := W
    If %Height% = 0
        Height := H
   
    X:=(A_ScreenWidth - Width) / 2
    Y:=0
    WinMove,A,,%X%,%Y%,%Width%,%Height%
}