ahk 是否可以设置 在excel里 按着 shiit 在用滚轮 进行 下面的滚轮拖动动作?

 

#IfWinActive,ahk_exe EXCEL.EXE
~Shift & WheelUp::  ; 向左滚动.
	SetScrollLockState, On
	Send {Left}
	SetScrollLockState, off
return

~Shift & WheelDown::  ; 向右滚动.
	SetScrollLockState, On
	Send {Right}
	SetScrollLockState, off
return
#IfWinActive

更好的版本

#IfWinActive,ahk_exe EXCEL.EXE
 ~LShift & WheelUp::  ; Scroll left.
 ControlGetFocus, fcontrol, A
 Loop 5  ; <-- Increase or decrease this value to scroll faster or slower.
    ComObjActive("Excel.application").ActiveWindow.SmallScroll(0,0,0,1)
 return

 ~LShift & WheelDown::  ; Scroll right.
 ControlGetFocus, fcontrol, A
 Loop 5  ; <-- Increase or decrease this value to scroll faster or slower.
 	ComObjActive("Excel.application").ActiveWindow.SmallScroll(0,0,1,0)
 return
#IfWinActive

如果控制word请用ComObjActive("Word.application").。。。。

Logo

讨论HarmonyOS开发技术,专注于API与组件、DevEco Studio、测试、元服务和应用上架分发等。

更多推荐