Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

While in While is my problem...i guess

$
0
0

I am completly new to autoit but i need it because it works for a problem i need to solve:

I want to click on different stuff in the corner of my screen. It goes 3 up then adjust the window and clicks the new 3 (works so far). Then if you press the up button it should go up again (it doesnt).

It needs to be triggered by keys and is just clicking up and down.

 

My problem is that it makes sense in my head what i did there but i have no idea how to tell autoit what i want.

I guess i used to many whiles cause thats the only thing that worked for me. the "Key" function is the same as _ispressed and 1 while alone it would even run up or down (the 1 click in between adjusts the window)

 

 

i am sorry for the huge mess i did there...please try to fix it!

AutoIt         
  1. #include "Key.au3"
  2.  
  3. ; going down
  4. $all = 1
  5. $u = 1
  6. $i = 1
  7. while $all = 1
  8.    Sleep(50)
  9.    While $i = 1
  10.       Sleep(50)
  11.       While Key("NUMPAD1")
  12.          MouseClick ("right", 1500 , 1000, 1, 0)
  13.          Sleep(10)
  14.          Send ("{DOWN}")
  15.          sleep (5)
  16.          Send ("{ENTER}")
  17.          $i = $i + 1
  18.          While $i = 2
  19.             Sleep(50)
  20.             While Key("NUMPAD1")
  21.                MouseClick ("right", 1500 , 1020, 1, 0)
  22.                Sleep(10)
  23.                Send ("{DOWN}")
  24.                sleep (5)
  25.                Send ("{ENTER}")
  26.                $i = $i + 1
  27.                While $i = 3
  28.                   Sleep(50)
  29.                   While Key("NUMPAD1")
  30.                      MouseClick ("right", 1500 , 1040, 1, 0)
  31.                      Sleep(10)
  32.                      Send ("{DOWN}")
  33.                      sleep (5)
  34.                      Send ("{ENTER}")
  35.                      Sleep(20)
  36.                      $i = $i + 1
  37.                      While $i = 4
  38.                         Sleep(50)
  39.                         While Key("NUMPAD1")
  40.                            MouseClick ("left", 1905 , 1047, 1, 0)
  41.                            Sleep (200)
  42.                            MouseClick ("right", 1500 , 1040, 1, 0)
  43.                            Sleep(10)
  44.                            Send ("{DOWN}")
  45.                            sleep (5)
  46.                            Send ("{ENTER}")
  47.                         WEnd
  48.                      WEnd
  49.                   WEnd
  50.                WEnd
  51.             WEnd
  52.          WEnd    
  53.       WEnd
  54.    WEnd
  55.  
  56. ; going up
  57.  
  58.    While $i = 5
  59.       Sleep(50)
  60.       While Key("NUMPAD4")
  61.          MouseClick ("right", 1500 , 1040, 1, 0)
  62.          Sleep(10)
  63.             Send ("{DOWN}")
  64.          sleep (5)
  65.          Send ("{ENTER}")
  66.          $i = $i + 1
  67.          While $i = 6
  68.             Sleep(50)
  69.             While Key("NUMPAD4")
  70.                MouseClick ("right", 1500 , 1020, 1, 0)
  71.                Sleep(10)
  72.                Send ("{DOWN}")
  73.                sleep (5)
  74.                Send ("{ENTER}")
  75.                $i = $i + 1
  76.                While $i = 7
  77.                   Sleep(50)
  78.                   While Key("NUMPAD4")
  79.                      MouseClick ("right", 1500 , 1000, 1, 0)
  80.                      Sleep(10)
  81.                      Send ("{DOWN}")
  82.                      sleep (5)
  83.                      Send ("{ENTER}")
  84.                      Sleep(20)
  85.                      $i = $i + 1
  86.                      While $i = 8
  87.                         Sleep(50)
  88.                         While Key("NUMPAD4")
  89.                            MouseClick ("left", 1905 , 987, 1, 0)
  90.                            Sleep (200)
  91.                            MouseClick ("right", 1500 , 1000, 1, 0)
  92.                               Sleep(10)
  93.                            Send ("{DOWN}")
  94.                            sleep (5)
  95.                            Send ("{ENTER}")
  96.                         WEnd
  97.                      WEnd
  98.                   WEnd
  99.                WEnd
  100.             WEnd
  101.          WEnd    
  102.       WEnd
  103.    WEnd
  104.  
  105. ; change direction logic ; from down to up
  106.  
  107.    While $i = 3
  108.       sleep (50)
  109.       While Key("NUMPAD4")
  110.          MouseClick ("right", 1500 , 1020, 1, 0)
  111.          Sleep(10)
  112.          Send ("{DOWN}")
  113.             sleep (5)
  114.          Send ("{ENTER}")
  115.          $i = 6
  116.       WEnd
  117.    WEnd
  118.  
  119.    While $i = 4
  120.       sleep (50)
  121.       While Key("NUMPAD4")
  122.          MouseClick ("right", 1500 , 1020, 1, 0)
  123.          Sleep(10)
  124.          Send ("{DOWN}")
  125.          sleep (5)
  126.          Send ("{ENTER}")
  127.          $i = 6
  128.       WEnd
  129.    WEnd
  130.  
  131.    While $i = 2
  132.       sleep (50)
  133.       While Key("NUMPAD4")
  134.          MouseClick ("right", 1500 , 1000, 1, 0)
  135.          Sleep(10)
  136.          Send ("{DOWN}")
  137.          sleep (5)
  138.          Send ("{ENTER}")
  139.          $i = 7
  140.       WEnd
  141.    WEnd
  142.  
  143.    While $i = 1
  144.       sleep (50)
  145.       While Key("NUMPAD4")
  146.          MouseClick ("left", 1905 , 987, 1, 0)
  147.          Sleep (200)
  148.          MouseClick ("right", 1500 , 1000, 1, 0)
  149.          Sleep(10)
  150.          Send ("{DOWN}")
  151.          sleep (5)
  152.          Send ("{ENTER}")
  153.          $i = 8
  154.       WEnd
  155.    WEnd
  156.  
  157. ; change direction logic ; from down to up
  158.  
  159.    While $i = 8
  160.       sleep (50)
  161.       While Key("NUMPAD2")
  162.          MouseClick ("right", 1500 , 1020, 1, 0)       
  163.          Sleep(10)
  164.          Send ("{DOWN}")
  165.          sleep (5)
  166.          Send ("{ENTER}")
  167.          $i = 2
  168.       WEnd
  169.    WEnd
  170.  
  171.    While $i = 7
  172.       sleep (50)
  173.       While Key("NUMPAD2")
  174.          MouseClick ("right", 1500 , 1020, 1, 0)
  175.          Sleep(10)
  176.          Send ("{DOWN}")           
  177.          sleep (5)
  178.          Send ("{ENTER}")
  179.          $i = 2
  180.       WEnd
  181.    WEnd
  182.  
  183.    While $i = 6
  184.       sleep (50)
  185.       While Key("NUMPAD2")
  186.          MouseClick ("right", 1500 , 1020, 1, 0)
  187.          Sleep(10)
  188.          Send ("{DOWN}")
  189.          sleep (5)
  190.          Send ("{ENTER}")
  191.          $i = 3
  192.       WEnd
  193.    WEnd
  194.  
  195.    While $i = 5
  196.       sleep (50)
  197.       While Key("NUMPAD2")
  198.          MouseClick ("right", 1500 , 1020, 1, 0)
  199.          Sleep(10)
  200.          Send ("{DOWN}")
  201.          sleep (5)
  202.          Send ("{ENTER}")
  203.          $i = 4
  204.       WEnd
  205.    WEnd

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>