any saved value is not the same as current value) If ( $ox $pos OR $oy $pos OR $oc $col ) Then save the current value $ox = $pos $oy = $pos $oc = $col update the labels with the current readings MousePos ( ) sleep for 25ms, this is here just so we don't read the cursor every processor tick Sleep ( 25 ) WEnd Function that reads the cursor Func MousePos ( ) get the mouse cursor position, absolute $pos = MouseGetPos ( ) get pixel color $col = PixelGetColor ( $pos, $pos ) if anything changed (i.e. The two -1 means the window will be centered on screen (this is AutoIt's doing, it's like we haven't specified WHERE we want the window exactly, so it just puts it in the middle) $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST - these are two constants - variables with predefined values, that tell the GUI to draw a windows with small border and always on top GUICreate ( "Cursor nfo", 160, 40, - 1, - 1, - 1, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST ) Create two labels, don't worry about text being empty for now, the reset is left, right, width, height $label1 = GUICtrlCreateLabel ( "", 5, 5, 150, 15 ) $label2 = GUICtrlCreateLabel ( "", 5, 20, 150, 15 ) helper variables, storing last known cursor position and color $ox = - 1 $oy = - 1 $oc = - 1 show our GUI window GUISetState ( ) In Infinite Loop do While True check GUI Messages (what windows sends to us) for possible events Switch GUIGetMsg ( ) Case $GUI_EVENT_CLOSE in the event user click the close button Exit EndSwitch call function MousePos Expand collapse popup include some constants we use, like $GUI_EVENT_CLOSE or $WS_EX_TOOLWINDOW #include #include Create a GUI window title will be 'Cursor nfo' width = 160, height = 40.
0 Comments
Leave a Reply. |