The Wiki for Tale 4 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

Difference between revisions of "User:Cegaiel/Macros/GetMousePosition"

From A Tale in the Desert
Jump to navigationJump to search
Line 1: Line 1:
<pre>
+
==Get Mouse Position and Color (Autohotkey)==
MsgBox Move mouse around screen for realtime information.`n`nPress the F2 key to copy the mouse position and color into Clipboard`n`nNote the color is RGB format!`nColor is useful if you want to use the PixelSearch function, in Autohotkey`n`nClick OK to continue...
 
  
 +
Just launch the script and it will show you this tooltip wherever you move the mouse.  All the information on tooltip updates in realtime as you move the mouse.
  
 +
[[Image:Cegcode1.jpg]]
  
#Persistent
 
SetTimer, WatchCursor, 100
 
return
 
  
 +
I wrote this in case I need to find the mouse position that I need to click on or if I need to find the color of where my mouse is hovering.
 +
<BR>
 +
I mainly added the color gathering portion in case I want to write a macro with the PixelSearch in autohotkey.
  
WatchCursor:
 
MouseGetPos, xpos, ypos
 
WinGetTitle, Title, A
 
  
 +
[[User:Cegaiel/Macros/GetMousePosition/Code|Get Code!]]
  
PixelGetColor, color, xpos, ypos, RGB
 
  
 +
<b>Example code for finding color:</b>
  
GetKeyState, state, F2
+
This will search for the color 0xE1D4AC (same as html code #E1D4AC) at mouse position 540,341.
if state = D
+
<BR>
{
+
If it finds that color, at that position (within 10 shades) then if will return errorlevel = 0
Clipboard = Mouse Position: %xpos%`, %ypos%`n`nColor: %color%`n`nActive Window: %Title%`n`nWindows Resolution: %A_ScreenWidth%x%A_ScreenHeight%
 
  
  
MsgBox Mouse Position: %xpos%, %ypos%`n`nColor: %color%`n`nThis information has been saved to the clipboard.`nPaste into Notepad with Ctrl+V at anytime.
+
<pre>
 +
PixelSearch, Px, Py, 540, 341, 540, 341, 0xE1D4AC, 10, Fast
 +
if ErrorLevel = 0
 +
{
 +
MsgBox, Color detected
 +
}else{
 +
Msgbox, Color not found
 
}
 
}
 
ToolTip, Mouse Position: %xpos%`, %ypos%`n`nColor: %color%`n`nActive Window: %Title%`n`nWindows Resolution: %A_ScreenWidth%x%A_ScreenHeight%
 
return
 
 
</pre>
 
</pre>

Revision as of 19:06, 14 January 2010

Get Mouse Position and Color (Autohotkey)

Just launch the script and it will show you this tooltip wherever you move the mouse. All the information on tooltip updates in realtime as you move the mouse.

Cegcode1.jpg


I wrote this in case I need to find the mouse position that I need to click on or if I need to find the color of where my mouse is hovering.
I mainly added the color gathering portion in case I want to write a macro with the PixelSearch in autohotkey.


Get Code!


Example code for finding color:

This will search for the color 0xE1D4AC (same as html code #E1D4AC) at mouse position 540,341.
If it finds that color, at that position (within 10 shades) then if will return errorlevel = 0


PixelSearch, Px, Py, 540, 341, 540, 341, 0xE1D4AC, 10, Fast
if ErrorLevel = 0
{
MsgBox, Color detected 
}else{
Msgbox, Color not found
}