Advertisement
Guest User

Untitled

a guest
Sep 29th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6.  
  7.  
  8.  
  9.  
  10. SetWorkingDir, %A_ScriptDir%
  11. CoordMode, Mouse, Screen
  12. CoordMode, Pixel, Screen
  13. Gui, 2: +AlwaysOnTop
  14. Gui, 2: Add, Button, x10 y10 w200 h20 gFind_Image, Find Image
  15. Gui, 2: Add, Button, x10 w200 h20 gGui_1, Load / Reload Image
  16. Gui, 2: Add, Text, x10, Press Numpad 1 to stop.
  17. Gui, 2: Show, x1000 y200
  18. return
  19. 2GuiClose:
  20.     ExitApp
  21.  
  22. Find_Image:
  23.     Stop := 0
  24.     While !Stop
  25.         {
  26.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, attack1.png
  27.             if(ErrorLevel = 2)
  28.             {
  29.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  30.             }
  31.             /*          Else if(ErrorLevel = 1)
  32.                 {
  33.                     MsgBox, Image not found.
  34.                     ;TrayTip,, Image Not Found., 2
  35.                 }
  36.             */     
  37.             Else if(ErrorLevel = 0)
  38.             {  
  39.                     ;TrayTip,, ********`n We found the image`n********
  40.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  41.                 tx := Loc_X ;+(posw//2)
  42.                 ty := Loc_Y ;+(posh//2)
  43.                 click, %tx% %ty%
  44.             }
  45.            
  46.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, attack2.png
  47.             if(ErrorLevel = 2)
  48.             {
  49.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  50.             }
  51.             /*          Else if(ErrorLevel = 1)
  52.                 {
  53.                     MsgBox, Image not found.
  54.                     ;TrayTip,, Image Not Found., 2
  55.                 }
  56.             */     
  57.             Else if(ErrorLevel = 0)
  58.             {  
  59.                     ;TrayTip,, ********`n We found the image`n********
  60.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  61.                 tx := Loc_X ;+(posw//2)
  62.                 ty := Loc_Y ;+(posh//2)
  63.                 click, %tx% %ty%
  64.             }
  65.            
  66.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, next1.png
  67.             if(ErrorLevel = 2)
  68.             {
  69.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  70.             }
  71.             /*          Else if(ErrorLevel = 1)
  72.                 {
  73.                     MsgBox, Image not found.
  74.                     ;TrayTip,, Image Not Found., 2
  75.                 }
  76.             */
  77.             Else if(ErrorLevel = 0)
  78.             {  
  79.                     ;TrayTip,, ********`n We found the image`n********
  80.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  81.                 tx := Loc_X ;+(posw//2)
  82.                 ty := Loc_Y ;+(posh//2)
  83.                 click, %tx% %ty%
  84.             }
  85.            
  86.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, next2.png
  87.             if(ErrorLevel = 2)
  88.             {
  89.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  90.             }
  91.             /*          Else if(ErrorLevel = 1)
  92.                 {
  93.                     MsgBox, Image not found.
  94.                     ;TrayTip,, Image Not Found., 2
  95.                 }
  96.             */     
  97.             Else if(ErrorLevel = 0)
  98.             {  
  99.                     ;TrayTip,, ********`n We found the image`n********
  100.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  101.                 tx := Loc_X ;+(posw//2)
  102.                 ty := Loc_Y ;+(posh//2)
  103.                 click, %tx% %ty%
  104.             }
  105.            
  106.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 135.png
  107.             if(ErrorLevel = 2)
  108.             {
  109.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  110.             }
  111.             /*          Else if(ErrorLevel = 1)
  112.                 {
  113.                     MsgBox, Image not found.
  114.                     ;TrayTip,, Image Not Found., 2
  115.                 }
  116.             */     
  117.             Else if(ErrorLevel = 0)
  118.             {  
  119.                 Stop = 1
  120.             }
  121.            
  122.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, 150.png
  123.             if(ErrorLevel = 2)
  124.             {
  125.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  126.             }
  127.             /*          Else if(ErrorLevel = 1)
  128.                 {
  129.                     MsgBox, Image not found.
  130.                     ;TrayTip,, Image Not Found., 2
  131.                 }
  132.             */     
  133.             Else if(ErrorLevel = 0)
  134.             {  
  135.                 Stop = 1
  136.             }
  137.            
  138.            
  139.            
  140.            
  141.            
  142.  
  143.            
  144.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, tobattle1.png
  145.             if(ErrorLevel = 2)
  146.             {
  147.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  148.             }
  149.             Else if(ErrorLevel = 1)
  150.             {
  151.                 ;MsgBox, Image not found.
  152.                         ;TrayTip,, Image Not Found., 2
  153.             }      
  154.             Else if(ErrorLevel = 0)
  155.             {  
  156.                     ;TrayTip,, ********`n We found the image`n********
  157.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  158.                 tx := Loc_X ;+(posw//2)
  159.                 ty := Loc_Y ;+(posh//2)
  160.                 click, %tx% %ty%
  161.             }
  162.            
  163.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, tobattle2.png
  164.             if(ErrorLevel = 2)
  165.             {
  166.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  167.             }
  168.             /*          Else if(ErrorLevel = 1)
  169.                 {
  170.                     MsgBox, Image not found.
  171.                     ;TrayTip,, Image Not Found., 2
  172.                 }
  173.             */     
  174.             Else if(ErrorLevel = 0)
  175.             {  
  176.                     ;TrayTip,, ********`n We found the image`n********
  177.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  178.                 tx := Loc_X ;+(posw//2)
  179.                 ty := Loc_Y ;+(posh//2)
  180.                 click, %tx% %ty%
  181.             }
  182.            
  183.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, fightaswar1.png
  184.             if(ErrorLevel = 2)
  185.             {
  186.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  187.             }
  188.             /*          Else if(ErrorLevel = 1)
  189.                 {
  190.                     MsgBox, Image not found.
  191.                     ;TrayTip,, Image Not Found., 2
  192.                 }
  193.             */     
  194.             Else if(ErrorLevel = 0)
  195.             {  
  196.                     ;TrayTip,, ********`n We found the image`n********
  197.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  198.                 tx := Loc_X ;+(posw//2)
  199.                 ty := Loc_Y ;+(posh//2)
  200.                 click, %tx% %ty%
  201.             }
  202.            
  203.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, fightaswar2.png
  204.             if(ErrorLevel = 2)
  205.             {
  206.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  207.             }
  208.             /*          Else if(ErrorLevel = 1)
  209.                 {
  210.                     MsgBox, Image not found.
  211.                     ;TrayTip,, Image Not Found., 2
  212.                 }
  213.             */     
  214.             Else if(ErrorLevel = 0)
  215.             {  
  216.                     ;TrayTip,, ********`n We found the image`n********
  217.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  218.                 tx := Loc_X ;+(posw//2)
  219.                 ty := Loc_Y ;+(posh//2)
  220.                 click, %tx% %ty%
  221.             }
  222.            
  223.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, endless1.png
  224.             if(ErrorLevel = 2)
  225.             {
  226.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  227.             }
  228.             /*          Else if(ErrorLevel = 1)
  229.                 {
  230.                     MsgBox, Image not found.
  231.                     ;TrayTip,, Image Not Found., 2
  232.                 }
  233.             */     
  234.             Else if(ErrorLevel = 0)
  235.             {  
  236.                     ;TrayTip,, ********`n We found the image`n********
  237.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  238.                 tx := Loc_X ;+(posw//2)
  239.                 ty := Loc_Y ;+(posh//2)
  240.                 click, %tx% %ty%
  241.             }
  242.            
  243.             ImageSearch, Loc_X, Loc_Y, 0, 0, A_ScreenWidth, A_ScreenHeight, endless2.png
  244.             if(ErrorLevel = 2)
  245.             {
  246.                 MsgBox, ErrorLevel = 2`nSomething is wrong.
  247.             }
  248.             /*          Else if(ErrorLevel = 1)
  249.                 {
  250.                     MsgBox, Image not found.
  251.                     ;TrayTip,, Image Not Found., 2
  252.                 }
  253.             */     
  254.             Else if(ErrorLevel = 0)
  255.             {  
  256.                     ;TrayTip,, ********`n We found the image`n********
  257.                     ;'MouseMove, Loc_X+(posw//2), Loc_Y+(posh//2)
  258.                 tx := Loc_X ;+(posw//2)
  259.                 ty := Loc_Y ;+(posh//2)
  260.                 click, %tx% %ty%
  261.             }          
  262.         }
  263.                         return
  264.                        
  265.                         GuiContextMenu:
  266.                         Gui, 1: Destroy
  267.                         return
  268.                        
  269.                         Move_Window:
  270.                         Random, new_x, 0, A_ScreenWidth -posw
  271.                         Random, new_y, 0, A_ScreenHeight -posh
  272.                         Gui, 1: Show, x%new_x%, y%new_y%
  273.                         return
  274.                        
  275.                        
  276.                         Gui_1()
  277.                         {
  278.                             global
  279.                             Gui, 1: Destroy
  280.                             Gui, 1: Margin,0,0
  281.                             Gui, 1: +AlwaysOnTop -Caption +Owner2
  282.                             Gui, 1: Add, Picture, x0 y0 vClip_Picture gMove_Window, capture.png
  283.                             GuiControlGet, Pos, 1: Pos, Clip_Picture
  284.                             Gui, 1: Show, AutoSize
  285.                         }
  286.                        
  287.                        
  288.                        
  289.                        
  290.                        
  291.                        
  292.                         Numpad1::
  293.                         Stop := 1
  294.                         return
  295.                        
  296.                         *ESC::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement