Skip to content

Instantly share code, notes, and snippets.

@dagezi
Created May 27, 2015 00:57
Show Gist options
  • Save dagezi/e86af4cb3bca89c6954a to your computer and use it in GitHub Desktop.
Save dagezi/e86af4cb3bca89c6954a to your computer and use it in GitHub Desktop.
ThumbRemap supports "Tap"+g,h
ThumbRemap_Init:
;1.有効にしたい方のコメントを削除
;#Include %A_ScriptDir%\Thumb_ALPS.ahk
#Include %A_ScriptDir%\Thumb_Synaptics.ahk
;2.タッチパッドに触れているときのみ有効化したいリマップを列挙
Thumb_Remap =
(
l
j
k
f
d
s
)
;3.タッチパッドに触れているときのみ有効化したいホットキーを列挙
Thumb_Hotkey =
(
m
i
,
h
g
)
;初期処理
Thumb_Deactivate()
Thumb_Init_Driver()
if A_ThisLabel=ThumbRemap_Init
return
else
Goto,ThumbRemap_End
;4.リマップ/ホットキーの定義を記述
#UseHook
j::LButton
k::MButton
l::RButton
f::LButton
d::RButton
s::MButton
g::Send,{vka6}
h::Send,{vka7}
m::Click,2
i::Click,WU
,::Click,WD
Thumb_SetState(state){
global
SetBatchLines,-1
Thumb_State:=state<<4 | Thumb_State & 0x0F
if(Thumb_State=0x10){
Thumb_Activate()
}else if(Thumb_State=0x01){
Thumb_Deactivate()
}
}
Thumb_Activate(){
global
Thumb_State=1
SetTimer,Thumb_WaitKeyUp,Off
Loop,Parse,Thumb_Remap,`n,`r%A_Tab%
{
Hotkey, *%A_LoopField%, On,p100
Hotkey, *%A_LoopField% up, On,p101
if(GetKeyState(A_LoopField)){
SetKeyDelay,-1
SendInput,{Blind}{%A_LoopField% up}
Gosub,*%A_LoopField%
}
}
Loop,Parse,Thumb_Hotkey,`n,`r%A_Tab%
Hotkey, %A_LoopField%, On,p100
}
Thumb_Deactivate(){
global
Thumb_State=0
Loop,Parse,Thumb_Hotkey,`n,`r%A_Tab%
Hotkey, %A_LoopField%, Off
Thumb_WaitKeyUp:=Thumb_Remap
Thumb_DeactivateRemap()
}
Thumb_DeactivateRemap(){
global Thumb_WaitKeyUp
Loop,Parse,Thumb_WaitKeyUp,`n,`r%A_Tab%
{
if(GetKeyState(A_LoopField,"P")){
tmp=%tmp%%A_LoopField%`n
}else{
Hotkey,*%A_LoopField%, Off
Hotkey,*%A_LoopField% up, Off
}
}
StringTrimRight,Thumb_WaitKeyUp,tmp,1
if(Thumb_RemapWait){
SetTimer,Thumb_WaitKeyUp,-50
}
}
Thumb_WaitKeyUp:
Thumb_DeactivateRemap()
return
#NoEnv
#Persistent
#MaxHotkeysPerInterval 1000
ThumbRemap_End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment