Windowsのデフォルトのスナップ機能(Win+矢印)が使いにくいので、Autohotkey使ってコマンドでできるようにした。
; ChangeKeyでCapslockをF24に置き換え
; F24 + i for special character insertion
F24 & i::
WinGet, vcurrentwindow, ID, A
vimestate := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint", vcurrentwindow), "UInt", 0x0283, "Int", 0x0005, "Int", 0)
If (vimestate=0) {
} Else {
Send, {vkf3}
} ; cf. https://qiita.com/neokix/items/83ac2ac8e1dd405528b0
InputBox, charstr, Autohotkey insertion, Enter key strings or "h" for help, , 240, 130
If ErrorLevel = 0
If charstr = l ; 左
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , 0, 0, A_ScreenWidth / 2, A_ScreenHeight
}
If charstr = r ; 右
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , A_ScreenWidth / 2, 0, A_ScreenWidth / 2, A_ScreenHeight
}
If charstr = lu ; 左上
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , 0, 0, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = ul ; 左上
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , 0, 0, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = ll ; 左下
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , 0, A_ScreenHeight / 2, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = ru ; 右上
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , A_ScreenWidth / 2, 0, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = ur ; 右上
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , A_ScreenWidth / 2, 0, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = rl ; 右下
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , A_ScreenWidth / 2, A_ScreenHeight / 2, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = lr ; 右下
{
WinGetTitle, Title, A
WinGetPos, x, y, w, h, %Title%
WinMove, %Title%, , A_ScreenWidth / 2, A_ScreenHeight / 2, A_ScreenWidth / 2, A_ScreenHeight / 2
}
If charstr = h ; ヘルプ
MsgBox, Autohotkey insertion help ("h")`n`n"l"`tMove window to the left of minotor`n"r"`tMove window to the right of minotor`n"lu"/"ul"`tMove window to the left upper of minotor`n"ll"`tMove window to the left lower of minotor`n"ru"/"ur"`tMove window to the right upper of minotor`n"rl"/"lr"`tMove window to the right lower of minotor`n`n
Return
0 件のコメント:
コメントを投稿