骗子 发表于 2011-9-18 21:34:21

HotKeySet 用法求助

想实现按CTRL + ALT +1 ~9来抓鼠标的坐标,有没有办法只用一个子程序来实现抓点的功能,而不是现在需要9个子程序

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <EditConstants.au3>
#include <IE.au3>
#include <_ini.au3>
#include <file.au3>
#include <Constants.au3>
#NoTrayIcon
#include <ClipBoard.au3>

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
For $i = 1 To 3
        HotKeySet("^!" & $i, "_zhuadian" & $i)
Next

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func _zhuadian1()
        Opt("MouseCoordMode", 2) ; Caret 坐标模式:1=绝对位置, 0=相对位置, 2=客户区
        $pos = MouseGetPos()
        ConsoleWrite ("第1个点的坐标为:" & $pos & "," & $pos & @CRLF)
EndFunc   ;==>_zhuadian
Func _zhuadian2()
        Opt("MouseCoordMode", 2) ; Caret 坐标模式:1=绝对位置, 0=相对位置, 2=客户区
        $pos = MouseGetPos()
        ConsoleWrite ("第2个点的坐标为:" & $pos & "," & $pos & @CRLF)
EndFunc   ;==>_zhuadian
Func _zhuadian3()
        Opt("MouseCoordMode", 2) ; Caret 坐标模式:1=绝对位置, 0=相对位置, 2=客户区
        $pos = MouseGetPos()
        ConsoleWrite ("第3个点的坐标为:" & $pos & "," & $pos & @CRLF)
EndFunc   ;==>_zhuadian


gzh888666 发表于 2011-9-18 21:58:15

本帖最后由 gzh888666 于 2011-9-18 21:59 编辑

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <EditConstants.au3>
#include <IE.au3>
;#include <_ini.au3>
#include <file.au3>
#include <Constants.au3>
;#NoTrayIcon
#include <ClipBoard.au3>

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 193, 125)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

For $i = 1 To 9
      _HotKeySet($i)
Next

While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

      EndSwitch
        WEnd
Func _HotKeySet($i)
        HotKeySet("^!" & $i, "_zhuadian")
EndFunc
Func _zhuadian()
      Opt("MouseCoordMode", 2) ; Caret 坐标模式:1=绝对位置, 0=相对位置, 2=客户区
      $pos = MouseGetPos()
        ConsoleWrite ("当前坐标为:" & $pos & "," & $pos & @CRLF)
EndFunc   ;==>_zhuadian
页: [1]
查看完整版本: HotKeySet 用法求助