thankyou so much =D.
that did help quite alot.
i am confused on why the color red is now in mall small gui box. (hitbox)
i thought that was ment to be transparent?
well anyway, il post for you my curent script (close to the same)
with the few "little" changes of colors and imgaes and what not.
i still have a problem with it, ahh it always left clicks after i press the "ok" button.
is there a certain oreder i should set it up, for example.
i just run the script the press ok.. is that all i need to make it work.
ot is it that i need to run the script search for it with f3 then press ok?
or something liek that?
i also get this msg/error?
" ! x805 y490 w37 h37! wanted upper left -> x805.000000 y490.000000 press ok to search"
im not sure if thats an error or instructions or something =s
Id like to thank you again, you have helped me with alot, especialy understanding how my script actualy workes, well alot more then i did.
i still find it quite complex, but im learning alot quicker then not asking questions =D
Code:
;============================================================================
; set coordinates for the screen so GUI position, search and clicks will align
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen
;-----------the gui hitbox---------------------------------------------------
bDim = 35 ; Change this to desired size.
;bDim = 5 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim
;============================================================================
; Leef_me's choice of pixel color
pixel_color= 0x0000FF ; search for red ; BLUE/GREEN/RED order
;Cyber's choice of pixel color
;pixel_color= 0x0000FF
;============================================================================
; If you want to test on an image you can enable this
image = ImgQL.bmp ; <------filename goes here
;gui, add, picture, , %image%
Gui, +alwaysontop
Gui, -Caption Border AlwaysOnTop ToolWindow
; RED/GREEN/BLUE order
Gui, Color, C0C0C0
Gui, Color, FF0000 ; <----- Leef_me's choice of GUI fill color
Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox
WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox
;============================================================================
; get the location of the box, without relying on the above xpos & ypos
; report actual location of the window, and save for imagesearch
WinGetPos , X, Y, Width, Height, hitBox
msgbox !%Title% x%X% Y%Y% W%Width% H%Height%! `n wanted upper_left-> X%xPos% Y%yPos% `n press OK to start search
;return
;================================================================================
;start the search
settimer, find_pixel,-1 ; wait 0.001 seconds before searching
return
;============================================================================
find_pixel:
b:=A_TickCount ; <--- measure the time the pixelsearch takes
pixelSearch , TL , BR , X, Y, X+Width, Y+Height, pixel_color ; BLUE/GREEN/RED order
c:=A_TickCount ; <--- measure the time the pixelsearch takes
d:=c-b
;============================================================================
; for testing, show a tooltip instead of causing a mouseclick
;tooltip, !!%errorlevel%!%TL%!%BR%!, xpos+50, ypos
; the next line shows 1/1000 second, 0 if found, x and y coordinates
tooltip, !%d%!!%errorlevel%!%TL%!%BR%!, xpos+50, ypos
;MouseClick [, WhichButton , X, Y, ClickCount, Speed, D|U, R]
MouseClick , left , TL , BR , 1 , 10
settimer, find_pixel , -200 ; wait 0.2 seconds between searches
return
;================================================================================
f3:: ; get the color of the pixel at the mouse cursor location
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen
; coodinates are relative to screen based on CoordMode used at top of script
MouseGetPos, xx , yy
PixelGetColor, cc, xx, yy
tooltip %xx% %yy% %cc%
return
;----------------------------end statemnts------------------------------------
esc::
^z::ExitApp
ps: the image is like 15-19pixels or something, im using paint.net, and it wldnt let me have 30-30 =s
all it is a completly greenish yelow color "an exact color of a part of the image im searching"
so to sumerise.
-im not sure how to properly run this efectivly?
-it always leftclicks when script is run?
-im not quite sure why the hitbox is now red?
-oh! and the new line of code
Code:
; get the location of the box, without relying on the above xpos & ypos
; report actual location of the window, and save for imagesearch
WinGetPos , X, Y, Width, Height, hitBox
msgbox !%Title% x%X% Y%Y% W%Width% H%Height%! `n wanted upper_left-> X%xPos% Y%yPos% `n press OK to start search
;return