Advertisement
TrunghieuTH10

AutoClick Don't Accounted Mouse

Sep 9th, 2015
1,782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 12.79 KB | None | 0 0
  1. #RequireAdmin
  2. #Region
  3.     #AutoIt3Wrapper_Icon=Icon.ico
  4.     #AutoIt3Wrapper_Res_Fileversion=1.7.1.1
  5.     #AutoIt3Wrapper_Res_ProductVersion=1.7.1.1
  6.     #AutoIt3Wrapper_Outfile=AutoClick Don't Accounted Mouse.exe
  7.     #AutoIt3Wrapper_Res_Field=Productname|AutoClick Don't Accounted Mouse By TrunghieuTH10
  8.     #AutoIt3Wrapper_Res_Description=Created By Nguyễn Trung Hiếu
  9.     #AutoIt3Wrapper_Res_LegalCopyright=©2015 TrunghieuTH10
  10.     #AutoIt3Wrapper_Res_Field=Email|Trunghieuth10@gmail.com
  11.     #AutoIt3Wrapper_Res_Field=CompanyName|https://facebook.com/trunghieuth10
  12.     #AutoIt3Wrapper_Res_Language=1066
  13.     #AutoIt3Wrapper_Res_Field=Compile Date|%date% %time%
  14.     #AutoIt3Wrapper_Compression=4
  15.     #AutoIt3Wrapper_UseUpx=y
  16.     #AutoIt3Wrapper_UseX64=n
  17.     #AutoIt3Wrapper_Run_Obfuscator=y
  18. #EndRegion
  19. #include <ButtonConstants.au3>
  20. #include <ComboConstants.au3>
  21. #include <EditConstants.au3>
  22. #include <GUIConstantsEx.au3>
  23. #include <GUIListBox.au3>
  24. #include <GuiStatusBar.au3>
  25. #include <StaticConstants.au3>
  26. #include <WindowsConstants.au3>
  27. #include <array.au3>
  28. If _singleton(@ScriptName&"_Setup", 1) = 0 Then Exit MsgBox(0,"Error", "Program is running",1)
  29. Func _singleton($soccurencename, $iflag = 0)
  30.     Local Const $error_already_exists = 183
  31.     Local Const $security_descriptor_revision = 1
  32.     Local $tsecurityattributes = 0
  33.     If BitAND($iflag, 2) Then
  34.         Local $tsecuritydescriptor = DllStructCreate("byte;byte;word;ptr[4]")
  35.         Local $aret = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "struct*", $tsecuritydescriptor, "dword", $security_descriptor_revision)
  36.         If @error Then Return SetError(@error, @extended, 0)
  37.         If $aret[0] Then
  38.             $aret = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "struct*", $tsecuritydescriptor, "bool", 1, "ptr", 0, "bool", 0)
  39.             If @error Then Return SetError(@error, @extended, 0)
  40.             If $aret[0] Then
  41.                 $tsecurityattributes = DllStructCreate($tagsecurity_attributes)
  42.                 DllStructSetData($tsecurityattributes, 1, DllStructGetSize($tsecurityattributes))
  43.                 DllStructSetData($tsecurityattributes, 2, DllStructGetPtr($tsecuritydescriptor))
  44.                 DllStructSetData($tsecurityattributes, 3, 0)
  45.             EndIf
  46.         EndIf
  47.     EndIf
  48.     Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", $tsecurityattributes, "bool", 1, "wstr", $soccurencename)
  49.     If @error Then Return SetError(@error, @extended, 0)
  50.     Local $lasterror = DllCall("kernel32.dll", "dword", "GetLastError")
  51.     If @error Then Return SetError(@error, @extended, 0)
  52.     If $lasterror[0] = $error_already_exists Then
  53.         If BitAND($iflag, 1) Then
  54.             Return SetError($lasterror[0], $lasterror[0], 0)
  55.         Else
  56.             Exit -1
  57.         EndIf
  58.     EndIf
  59.     Return $handle[0]
  60. EndFunc
  61.  
  62. Func _WinAPI_DrawAnimatedRects($hwnd, $ianim, $prectfrom, $prectto)
  63.     Local $aresult = DllCall("user32.dll", "int", "DrawAnimatedRects", "hwnd", $hwnd, "int", $ianim, "ptr", $prectfrom, "ptr", $prectto)
  64.     If @error Then Return SetError(1, 0, 0)
  65.     Return $aresult[0]
  66. EndFunc   ;==>_winapi_drawanimatedrects
  67.  
  68. Global $htray = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "TrayNotifyWnd1")
  69. Global $Struct = DllStructCreate($tagPoint)
  70. Global $idani_caption = 3, $hien=True,$chay=False,$fminimized = False
  71. Global $button, $tpoint, $x, $y, $hwnd
  72. Global $Struct = DllStructCreate($tagPoint), $y_ctrl[0], $x_ctrl[0], $ctrl_hwnd[0]
  73. Opt("TrayOnEventMode", 1)
  74. TraySetIcon("Shell32.dll", 29)
  75. TraySetOnEvent(-13, "_Restore")
  76. TraySetClick(16)
  77. _GUI()
  78. Func _GUI()
  79.     Global $Form1 = GUICreate("* AutoClick Don't Accounted Mouse Beta 1", 293, 226, 525, 185, 0x2200)
  80.     Global $Group1 = GUICtrlCreateGroup("  *Coordinates*  ", 8, 8, 97, 161)
  81.     Global $List = GUICtrlCreateList("", 16, 80, 81, 84)
  82.     Global $Label1 = GUICtrlCreateLabel("X:", 16, 24, 66, 17)
  83.     Global $Label2 = GUICtrlCreateLabel("Y:", 16, 40, 66, 17)
  84.     Global $Label3 = GUICtrlCreateLabel("Total:", 16, 56, 55, 17)
  85.     Global $Clear = GUICtrlCreateButton("X", 77, 55, 20, 20)
  86.     Global $Group2 = GUICtrlCreateGroup("AutoClick Options", 120, 8, 161, 129)
  87.     Global $Group3 = GUICtrlCreateGroup("Click Point", 128, 24, 73, 57)
  88.     Global $Radio1 = GUICtrlCreateRadio("Multi", 136, 39, 57, 17)
  89.     Global $Radio2 = GUICtrlCreateRadio("Single", 136, 59, 57, 17)
  90.     GUICtrlSetState(-1, $GUI_CHECKED)
  91.     Global $Group4 = GUICtrlCreateGroup("Time", 208, 24, 65, 57)
  92.     GUICtrlCreateLabel("s", 220, 38, 14, 17)
  93.     Global $Input1 = GUICtrlCreateInput("1", 215, 55, 20, 21)
  94.     GUICtrlCreateLabel("ms", 245, 38, 25, 17)
  95.     Global $Input2 = GUICtrlCreateInput("000", 237, 55, 30, 21)
  96.     Global $Group5 = GUICtrlCreateGroup("Mouse Click Options", 128, 88, 145, 41)
  97.     Global $Combo = GUICtrlCreateCombo("Left Click", 136, 104, 129, 25, 3)
  98.     GUICtrlSetData(-1, "Left Double Click|Middle Click|Middle Double Click|Right Click|Right Double Click")
  99.     Global $Button1 = GUICtrlCreateButton("Start", 120, 144, 49, 25)
  100.     Global $Button2 = GUICtrlCreateButton("Hide", 176, 144, 51, 25)
  101.     Global $Button3 = GUICtrlCreateButton("Exit", 232, 144, 49, 25)
  102.     GUICtrlSetTip($Clear,"Reset Coordinates")
  103.     GUICtrlSetTip($Radio1,"Single Point Click")
  104.     GUICtrlSetTip($Radio2,"Multi Point Click")
  105.     GUICtrlSetTip($Button1,"F3 To Start And Hide")
  106.     GUICtrlSetTip($Button2,"Hide To Taskbar")
  107.     GUICtrlSetTip($Button3,"F4 or ESC TO Exit Program")
  108.     GUICtrlSetTip($Label1,"Width")
  109.     GUICtrlSetTip($Label2,"Height")
  110.     GUICtrlSetTip($Label3,"Total Coordinates Selected - F6 For More Details")
  111.     Global $StatusBar = _GUICtrlStatusBar_Create($Form1)
  112.     _GUICtrlStatusBar_SetSimple($StatusBar)
  113.     _GUICtrlStatusBar_SetText($StatusBar, "F1: Goto Help File")
  114.     Local $f1 = HotKeySet("{F1}", "_help")
  115.     Local $f2 = HotKeySet("{F2}", "_getpos")
  116.     Local $f3 = HotKeySet("{F3}", "_Run")
  117.     Local $f4 = HotKeySet("{F4}", "_Exit")
  118.     Local $f6 = HotKeySet("{F6}", "_views")
  119.     Local $f7 = HotKeySet("{F7}", "_clear")
  120.     Local $f8 = HotKeySet("{F8}", "_Restore")
  121.     Local $es = HotKeySet("{ESC}", "_Exit")
  122.     SplashTextOn("", "Di chuột vào cửa sổ, chọn điểm cần click rồi bấm F2 để lấy cửa sổ và điểm AutoClick. - F3 để bắt đầu và ẩn chương trình", "800", "18", "-1", "10", 33, "Tahoma", "10", "700")
  123.     GUISetState(@SW_SHOW)
  124.     While 1
  125.         $nMsg = GUIGetMsg()
  126.         Switch $nMsg
  127.             Case $Clear
  128.                 _clear()
  129.             Case $Button3
  130.                 Exit
  131.             Case $Button2
  132.                 _minimize()
  133.             Case $Button1
  134.                 _Start()
  135.         EndSwitch
  136.     WEnd
  137. EndFunc
  138.  
  139. Func _help()
  140.     SplashTextOn("", "Hướng Dẫn Sử Dụng AutoClick Không chiếm chuột", "480", "18", "-1", "10", 33, "Tahoma", "10", "700")
  141.     GUIDelete($Form1)
  142.     Local $f1 = HotKeySet("{F1}")
  143.     Local $f2 = HotKeySet("{F2}")
  144.     Local $f3 = HotKeySet("{F3}")
  145.     Local $f4 = HotKeySet("{F4}","_Exit")
  146.     Local $f6 = HotKeySet("{F6}")
  147.     Local $f7 = HotKeySet("{F7}")
  148.     Local $f8 = HotKeySet("{F8}")
  149.     Local $es = HotKeySet("{ESC}", "_Exit")
  150.     $Form2 = GUICreate("*Help*", 270, 270, 530, 185, 0x2200)
  151.     $Form2B = GUICtrlCreateButton("Close", 80, 200, 105, 33)
  152.     GUICtrlCreateLabel("TrunghieuTH10@gmail.com", 70, 3, 137, 17)
  153.     GUICtrlCreateLabel("F1: Help", 20, 24, 44, 17)
  154.     GUICtrlCreateLabel("F2: Select Mouse Point In Windows", 20, 48, 173, 17)
  155.     GUICtrlCreateLabel("F3: Start/Pause  (Miniminze In Taskbar)", 20, 72, 191, 17)
  156.     GUICtrlCreateLabel("F4/ESC: Exit Program", 20, 96, 107, 17)
  157.     GUICtrlCreateLabel("F6: Details Coordinates In Multi Point Click", 20, 120, 203, 17)
  158.     GUICtrlCreateLabel("F7: Clear All Coordinates", 20, 144, 119, 17)
  159.     GUICtrlCreateLabel("F8: Exit Minimize, Shows GUI Program", 20, 168, 184, 17)
  160.     GUISetState(@SW_SHOW, $Form2)
  161.     While 1
  162.         $nMsg = GUIGetMsg()
  163.         If $nmsg = $Form2B Then
  164.             GUIDelete($Form2)
  165.             _GUI()
  166.             ExitLoop
  167.         EndIf
  168.     WEnd
  169. EndFunc
  170.  
  171. Func _Run()
  172.     _Start()
  173.     _minimize()
  174. EndFunc
  175.  
  176. Func _minimize()
  177.     Local $trcfrom, $trcto
  178.     If Not $fminimized Then
  179.         $trcfrom = _WinAPI_GetWindowRect($form1)
  180.         $trcto = _WinAPI_GetWindowRect($htray)
  181.         _WinAPI_DrawAnimatedRects($form1, $idani_caption, DllStructGetPtr($trcfrom), DllStructGetPtr($trcto))
  182.         GUISetState(@SW_HIDE)
  183.         $fminimized = True
  184.     EndIf
  185. EndFunc   ;==>_minimize
  186.  
  187. Func _restore()
  188.     If $fminimized Then
  189.         $trcfrom = _WinAPI_GetWindowRect($htray)
  190.         Local $trcto = _WinAPI_GetWindowRect($form1)
  191.         _WinAPI_DrawAnimatedRects($form1, $idani_caption, DllStructGetPtr($trcfrom), DllStructGetPtr($trcto))
  192.         GUISetState(@SW_SHOW)
  193.         $fminimized = False
  194.     EndIf
  195. EndFunc   ;==>_restore
  196.  
  197. Func _Exit()
  198.     ProcessClose(@ScriptFullPath)
  199.     Exit
  200. EndFunc   ;==>_Exit
  201.  
  202. Func _Start()
  203.     If NOT $hwnd Then
  204.         MsgBox(0,"Chú ý","Di chuột vào cửa sổ, chọn điểm cần click rồi bấm F2 để lấy cửa sổ và điểm AutoClick")
  205.         Return 0
  206.     EndIf
  207.     If GUICtrlRead($button1) = "Start" Then
  208.         SplashTextOn("","",-1,0,-600,-600,1)
  209.         GUICtrlSetData($button1, "Stop")
  210.     Else
  211.         SplashTextOn("", "Di chuột vào cửa sổ, chọn điểm cần click rồi bấm F2 để lấy cửa sổ và điểm AutoClick. - F3 để bắt đầu và ẩn chương trình", "800", "18", "-1", "10", 33, "Tahoma", "10", "700")
  212.         GUICtrlSetData($button1, "Start")
  213.     EndIf
  214.     $chay = NOT $chay
  215.     $button = GUICtrlRead($Combo)
  216.     _autoclick($x, $y, $button)
  217.     If $chay Then
  218.         timer(1)
  219.     Else
  220.         timer(0)
  221.     EndIf
  222. EndFunc
  223.  
  224. Func timer($t)
  225.     $time1=GUICtrlRead($Input1)
  226.     $time2=GUICtrlRead($Input2)
  227.     If $time1="" Then $time1=0
  228.     If $time2="" Then $time2="000"
  229.     $time=Int($time1&$time2)
  230.     If $t=1 Then
  231.         AdlibRegister("_click",$time)
  232.     Else
  233.         AdlibUnRegister("_click")
  234.     EndIf
  235. EndFunc
  236.  
  237. Func _click()
  238.     _autoclick($x,$y,$button)
  239. EndFunc
  240.  
  241. Func _autoclick($x=0,$y=0,$button='Left Click')
  242.     Local $radio = GUICtrlRead($radio1)
  243.     If $radio = 1 Then
  244.         For $i = 0 To UBound($ctrl_hwnd) - 1
  245.             Global $lParam = ($y_ctrl[$i] * 65536) + ($x_ctrl[$i])
  246.             _button()
  247.         Next
  248.     Else
  249.         Global $lparam = ($y * 65536) + ($x)
  250.         _button()
  251.     EndIf
  252. EndFunc
  253.  
  254. Func _button()
  255.     Switch $button
  256.         Case $button='Left Click'
  257.             _WinAPI_PostMessage($hwnd, 0x201, 0x1,$lParam)
  258.             _WinAPI_PostMessage($hwnd, 0x202, 0,$lParam)
  259.         Case $button='Left Double Click'
  260.             _WinAPI_PostMessage($hwnd, 0x201, 0x1,$lParam)
  261.             _WinAPI_PostMessage($hwnd, 0x202, 0,$lParam)
  262.             _WinAPI_PostMessage($hwnd, 0x203, 0x1,$lParam)
  263.             _WinAPI_PostMessage($hwnd, 0x202, 0,$lParam)
  264.         Case $button='Middle Click'
  265.             _WinAPI_PostMessage($hwnd, 0x207, 0x10,$lParam)
  266.             _WinAPI_PostMessage($hwnd, 0x208, 0,$lParam)
  267.         Case $button='Middle Double Click'
  268.             _WinAPI_PostMessage($hwnd, 0x207, 0x10,$lParam)
  269.             _WinAPI_PostMessage($hwnd, 0x208, 0,$lParam)
  270.             _WinAPI_PostMessage($hwnd, 0x209, 0x10,$lParam)
  271.             _WinAPI_PostMessage($hwnd, 0x208, 0,$lParam)
  272.         Case $button='Right Click'
  273.             _WinAPI_PostMessage($hwnd, 0x204, 0x2,$lParam)
  274.             _WinAPI_PostMessage($hwnd, 0x205, 0,$lParam)
  275.         Case $button='Right Double Click'
  276.             _WinAPI_PostMessage($hwnd, 0x204, 0x2,$lParam)
  277.             _WinAPI_PostMessage($hwnd, 0x205, 0,$lParam)
  278.             _WinAPI_PostMessage($hwnd, 0x206, 0x2,$lParam)
  279.             _WinAPI_PostMessage($hwnd, 0x205, 0,$lParam)
  280.     EndSwitch
  281. EndFunc
  282.  
  283. Func _getpos()
  284.     Local $radio = GUICtrlRead($Radio1)
  285.     If $radio = 1 Then
  286.         DllStructSetData($struct, "x", MouseGetPos(0))
  287.         DllStructSetData($struct, "y", MouseGetPos(1))
  288.         $hwnd = _winapi_windowfrompoint($struct)
  289.         _winapi_screentoclient($hwnd, $struct)
  290.         $x = DllStructGetData($struct, "x")
  291.         $y = DllStructGetData($struct, "y")
  292.         _ArrayAdd($x_ctrl, $x)
  293.         _ArrayAdd($y_ctrl, $y)
  294.         _ArrayAdd($ctrl_hwnd, $hwnd)
  295.         For $i = 0 To UBound($ctrl_hwnd) - 1
  296.             GUICtrlSetData($List, $x&" x "&$y)
  297.             GUICtrlSetData($Label3,"Total: "&$i+1)
  298.         Next
  299.         GUICtrlSetData($Label1,"X: "&$x)
  300.         GUICtrlSetData($Label2,"Y: "&$y)
  301.     Else
  302.         DllStructSetData($struct, "x", MouseGetPos(0))
  303.         DllStructSetData($struct, "y", MouseGetPos(1))
  304.         $hwnd = _winapi_windowfrompoint($struct)
  305.         _winapi_screentoclient($hwnd, $struct)
  306.         $x = DllStructGetData($struct, "x")
  307.         $y = DllStructGetData($struct, "y")
  308.         GUICtrlSetData($Label3,"Total: 1")
  309.         GUICtrlSetData($Label1,"X: "&$x)
  310.         GUICtrlSetData($Label2,"Y: "&$y)
  311.     EndIf
  312. EndFunc
  313.  
  314. Func _clear()
  315.     If GUICtrlRead($button1) = "Stop" Then
  316.         MsgBox(0,"Error -", "Program is runing. Please Click Stop Button And Try Again",5)
  317.     Else
  318.         SplashTextOn("", "Di chuột vào cửa sổ, chọn điểm cần click rồi bấm F2 để lấy cửa sổ và điểm AutoClick. - F3 để bắt đầu và ẩn chương trình", "800", "18", "-1", "10", 33, "Tahoma", "10", "700")
  319.         $hwnd = 0
  320.         GUICtrlSetData($button1, "Start")
  321.         For $i = 0 To UBound($ctrl_hwnd) - 1
  322.             _ArrayDelete($x_ctrl, UBound($ctrl_hwnd) - 1)
  323.             _ArrayDelete($y_ctrl,UBound($ctrl_hwnd) - 1)
  324.             _ArrayDelete($ctrl_hwnd,UBound($ctrl_hwnd) - 1)
  325.         Next
  326.         GUICtrlSetData($Label1,"X:")
  327.         GUICtrlSetData($Label2,"Y:")
  328.         GUICtrlSetData($Label3,"Total")
  329.         GUICtrlSetData($List,"")
  330.     EndIf
  331. EndFunc
  332.  
  333. Func _views()
  334.  _ArrayDisplay($x_ctrl, "x")
  335.  _ArrayDisplay($y_ctrl, "y")
  336.  _ArrayDisplay($ctrl_hwnd, "ctrl")
  337. EndFunc   ;==>i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement