0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Autohotkeyによるマウスジェスチャ

Posted at
MouseGesture.ahk

CoordMode,Mouse
DetectHiddenWindows, On

F17::Gosub,B4
return

B4:
;ジェスチャ用のガイドを表示
MouseGetPos,X1,Y1,W1
mx1:= X1 -100
my1:= Y1 -100
SplashImage,R:\G.png,B X%mx1% Y%my1% W200 ZH200 ZW200 CW00FF00 Hide,,
;縦横200pxでバツの字の画像を想定。背景色00FF00。
WinSet,TransColor,00ff00,%A_ScriptName%
SplashImage,show
SetTimer,STATE4,16
return

STATE4:
;ボタン押し上げを検知
WinActivate,ahk_id %W1%
;マウス直下にイベントを送る方が好き
GetKeyState,S4,F17
If(S4="U"){
MouseGetPos,X2,Y2
SetTimer,STATE4,Off
Gosub,FC4
}
return

FC4:
;マウス位置検知及び機能実行
SplashImage,off
X0:= X2-X1
Y0:= Y2-Y1
XR:= X0 **2
YR:= Y0 **2
R := XR+YR
MouseMove,X1,Y1,0
;半径30px以内で放したならば
If(R < 900){
Send,{MButton}
}
;上下左右方向に対する機能分岐
Else,{
If(XR > YR){
If(X0 < 0){
Send,^v
;右
}
If(X0 > 0){
Send,^c
;左
}
}
If(YR > XR){
If(Y0 < 0){
Send,{Esc}
;上
}
If(Y0 >0){
Send,{Enter}
;下
}
}
}
return

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?