Jump to content

7upinhere

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by 7upinhere

  1. I did not HAVE to use PixelGetColour it was suggested by John who by judging from his/her post count has a good enough knowledge of autoit. It would be a bit dumb me coming here for advice and then not trying advice that was offered, no?
  2. Yep this works great thanks I added a while/wend to make it loop and made a few minor adjustments.
  3. I guess there is no reason not to use ControlClick I just saw examples of MouseClick and thought that would be best to use. The application that the script will be interfacing will be running on a separate laptop so there is no need to worry about it not being on top. Anyway I would like to figure out why its not working before I rewrite it using contolclicks but thank you for the advice.
  4. Sorry mybad I was in a rush to leave and got the two confused. Ok I have given it another go and tried to tidy it up still with not much luck, I checked over the help file about the correct grammar and I think I did it correct. HotKeySet("{ESC}", "Terminate") HotKeySet("{c}", "Copy") Local $box1 = PixelGetColor(1400, 530) Local $box2 = PixelGetColor(1560, 530) Local $box3 = PixelGetColor(1700, 530) Local $box4 = PixelGetColor(1850, 530) local $colour = 0x202020 if $box1 = $colour Then MouseMove($box1[0],$box1[1]) mouseclick("left") Sleep(15) ElseIf $box2 = $colour Then MouseMove($box2[0],$box2[1]) mouseclick("left") Sleep(15) ElseIf $box3 = $colour Then MouseMove($box3[0],$box3[1]) mouseclick("left") Sleep(15) Elseif $box4 = $colour Then MouseMove($box4[0],$box4[1]) mouseclick("left") Sleep(15) EndIf
  5. Ok so I assume you are saying that PixelGetColour is a faster method than pixelsearch This is what I just came up with im sure I have the grammar of AHK wrong could I get some feedback on it thank you HotKeySet("{ESC}", "Terminate") $box1 = PixelGetColor(1400, 530) $box2 = PixelGetColor(1560, 530) $box3 = PixelGetColor(1700, 530) $box4 = PixelGetColor(1850, 530) if $box1 = 0x202020 Then MouseMove($box1[0],$box1[1]) mouseclick("left") Sleep(15) Else if $box2 = 0x202020 Then MouseMove($box2[0],$box2[1]) mouseclick("left") Sleep(15) Else if $box3 = 0x202020 Then MouseMove($box3[0],$box3[1]) mouseclick("left") Sleep(15) Else if $box4 = 0x202020 Then MouseMove($box4[0],$box4[1]) mouseclick("left") Sleep(15)
  6. Or would it perhaps go after the first $coord = PixelSearch( 1490, 720, 1776, 720, 0x202020, 0 ) Something like this $coord = PixelSearch( 1400, 720, 1400, 720, 0x202020, 0 ), $coord2 = PixelSearch( 1560, 720, 1560, 720, 0x202020, 0 ), $coord3 = PixelSearch( 1700, 720, 1700, 720, 0x202020, 0 ), $coord4 = PixelSearch( 1850, 720, 1850, 720, 0x202020, 0 ) Or am I way off track? Thanks.
  7. Hi I am currently trying to speed up the following code ; Press Esc to terminate script, Pause/Break to "pause" Global $Paused, $counter = 0 HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d ;;;; Body of program would go here;;;; While 1 $coord = PixelSearch( 1490, 720, 1776, 720, 0x202020, 0 ) If @error = 0 Then ;; if color found the do action MouseMove($coord[0],$coord[1]) mouseclick("left") Sleep(15) Else ;; if not wait 5 secs and repeat Sleep(1000) EndIf Wend ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0, $counter, 1) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc the above "works" but I think that searching 4 specific pixels for 0x202020 rather than a range of pixels would be much faster? So I used Autoit window info to gather the following information pixel1 1400, 530 0x202020 pixel2 1560, 530 0x202020 pixel3 1700, 530 0x202020 pixel4 1850, 530 0x202020 now with my basic knowledge I understand that using if/else I would need to set the pixelsearch to for the first location which seeing the correct pixel colour would click the mouse While 1 $coord = PixelSearch( 1400, 530, 1400, 530, 0x202020, 0 ) If @error = 0 Then ;; if color found the do action MouseMove($coord[0],$coord[1]) mouseclick("left") Sleep(15) Else ;; if not wait 5 secs and repeat Sleep(1000) EndIf Wend and if 0x202020 was not present at 1400, 530 it would then check 1560, 530 and if not present there it would check 1700, 530 and so on. looped so I am guessing that that information would go in the else section but I am having trouble converting my thinking into correct code Any help would be much appreciated.
×
×
  • Create New...