[AAuto] 纯文本查看 复制代码
#include <Misc.au3>
Global $sTitle='Simple Click'
If _Singleton($sTitle, 1) = 0 Then Exit
#include <WinAPISysWin.au3>
#include <FontConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIGdiInternals.au3>
#include <GuiToolTip.au3>
#include <SendMessage.au3>
Global $Mkey
Global $Paused = True
Global const $sTooltipText='["`"->开始或暂停,"shift+`"->退出,"ESC"->切换左右键]'
Global $sKey='左键',$sState='暂停'
Global $Form1=GUICreate($sTitle,Default,Default,Default,Default,Default,$WS_EX_TOPMOST)
Global $hToolTipFont = _WinAPI_CreateFont(22, 0, 0, 0, 700, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, '微软雅黑')
Global $hToolTipHwnd = _GUIToolTip_Create($Form1, 0x00000001)
_GUIToolTip_SetMaxTipWidth($hToolTipHwnd, 600)
DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", $hToolTipHwnd, "wstr", "", "wstr", "") ;关闭视觉样式
_SendMessage($hToolTipHwnd, $TTM_SETTIPTEXTCOLOR, _WinAPI_SwitchColor(12632256)) ;启用视觉样式后,此消息不起作用
_SendMessage($hToolTipHwnd, $TTM_SETTIPBKCOLOR, _WinAPI_SwitchColor(16448)) ;启用视觉样式后,此消息不起作用
_SendMessage($hToolTipHwnd, $WM_SETFONT, $hToolTipFont, 1)
_WinAPI_SetWindowLong($hToolTipHwnd,$GWL_EXSTYLE, BitOR( _WinAPI_GetWindowLong($hToolTipHwnd,$GWL_EXSTYLE), $WS_EX_TRANSPARENT, $WS_EX_LAYERED))
_WinAPI_SetLayeredWindowAttributes($hToolTipHwnd, 0x010101,100)
_GUIToolTip_AddTool($hToolTipHwnd, 0, $sKey & $sState & ' ' & $sTooltipText, 0, 0, 0, 0, 0, 0x00000080 + 0x00000020)
_GUIToolTip_TrackActivate($hToolTipHwnd, True, 0, 0)
_SendMessage($hToolTipHwnd, 0X400 + 18, 0, 0)
;Shift-Esc
HotKeySet("+`", "EscD") ;Shift-Esc
HotKeySet("{Esc}", "EscDun")
HotKeySet("`", "Paus")
While 1
If Not $Paused Then
If Not $Mkey Then
MouseClick("left")
Else
MouseClick("right")
EndIf
EndIf
Sleep(20)
WEnd
Func EscDun()
$Mkey = Not $Mkey
$sKey = $Mkey = true ? '右键' : '左键'
_GUIToolTip_UpdateTipText($hToolTipHwnd,0,0,$sKey & $sState & ' ' & $sTooltipText)
EndFunc ;==>EscDun
Func Paus()
$Paused = Not $Paused
$sState = $Paused = true ? '暂停' : '运行'
_GUIToolTip_UpdateTipText($hToolTipHwnd,0,0,$sKey & $sState & ' ' & $sTooltipText)
While $Paused
Sleep(100)
WEnd
EndFunc ;==>Paus
Func EscD()
Exit
EndFunc ;==>EscD