Advertisement
Guest User

AutoIT project

a guest
Oct 16th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.58 KB | None | 0 0
  1. #include <AutoItConstants.au3>
  2. #include <ImageSearch 64 bit/ImageSearch.au3>
  3. #include <Misc.au3>
  4. #include <ImageSearch.au3>
  5. HotKeySet("{f1}", "myExit")
  6.  
  7. Global $Counter = 1
  8.  
  9. init(); changed all that to a function to call one time(  readability)
  10.  
  11. while 1
  12.     $timer = timerinit()
  13.     Do
  14.         MouseClick("Left", 614, 532, 1, 2)
  15.         sleep(500)
  16.         MouseClick("Left", 713, 598, 1, 2)
  17.         Call ( "myResult", $Counter )
  18.         sleep(2000)
  19.         MouseClick("Left", 472, 333, 1, 2)
  20.         sleep(500)
  21.         MouseClick("Left", 713, 598, 1, 2)
  22.         Call ( "myResult", $Counter )
  23.         sleep(2000)
  24.         MouseClick("Left", 614, 532, 1, 2)
  25.         sleep(500)
  26.         MouseClick("Left", 713, 598, 1, 2)
  27.         Call ( "myResult", $Counter )
  28.         sleep(2000)
  29.         MouseClick("Left", 614, 532, 1, 2)
  30.         sleep(500)
  31.         MouseClick("Left", 713, 598, 1, 2)
  32.         Call ( "myResult", $Counter )
  33.         sleep(2000)
  34.         MouseClick("Left", 472, 333, 1, 2)
  35.         sleep(500)
  36.         MouseClick("Left", 713, 598, 1, 2)
  37.         Call ( "myResult", $Counter )
  38.         sleep(2000)
  39.         MouseClick("Left", 472, 333, 1, 2)
  40.         sleep(500)
  41.         MouseClick("Left", 713, 598, 1, 2)
  42.         Call ( "myResult", $Counter )
  43.         Sleep(2000)
  44.     until timerdiff($timer) > 960;
  45. WEnd
  46.  
  47.  
  48. func myResult($Counter)
  49.     ;ConsoleWrite(" Function myresult is called " & @CRLF)
  50.     $Variable = _ImageSearch("quinto.bmp",$x,$y,100) Or _ImageSearch("quarto.bmp",$x,$y,100)
  51.     If IsArray($Variable) = True Then
  52.         ConsoleWrite(" Win is found " & @CRLF)
  53.         MouseClick("Left", 888, 597, 1, 1)
  54.         MouseClick($MOUSE_CLICK_LEFT,  $Variable[0], $Variable[1], $Counter)
  55.     Else
  56.         $Variable = _ImageSearch("primo.bmp",$x,$y,100) Or _ImageSearch("secondo.bmp",$x,$y,100) Or _ImageSearch("terzo.bmp",$x,$y,100)
  57.         If IsArray($Variable) = True Then
  58.             ConsoleWrite(" no win is found " & @CRLF)
  59.             For $vElement In $Variable
  60.                 $Counter = $Counter * 2
  61.             Next
  62.             MouseClick($MOUSE_CLICK_LEFT, $Variable[0], $Variable[1], $Counter)
  63.         EndIf
  64.     EndIf
  65. EndFunc
  66.  
  67. Func init()
  68.     WinActivate("Identikit")
  69.     WinWaitActive("Identikit", "", 10); wait for 10 sec to appear
  70.     MouseClick("Left", 529, 594, 1, 1)
  71.     sleep(4000)
  72.     MouseWheel($MOUSE_WHEEL_DOWN, 2)
  73.     sleep(500)
  74.     MouseClick("Left", 755, 578, 1, 1)
  75.     sleep(2000)
  76.     MouseClick("Left", 823, 598, 1, 1)
  77.     sleep(16000)
  78.     MouseWheel($MOUSE_WHEEL_DOWN, 1)
  79.     sleep(1000)
  80. EndFunc
  81.  
  82. func myExit()
  83.     Exit
  84. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement