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.

User:Cegaiel/Macros/GetMousePosition/Code

From A Tale in the Desert
Jump to navigationJump to search
;Author: Cegaiel
;Last Update: 10/25/2010



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...



#Persistent
SetTimer, WatchCursor, 100
return


WatchCursor:
MouseGetPos, xpos, ypos 
WinGetTitle, Title, A 
WinGetActiveStats, win_Title, Xmax, Ymax, win_Xpos, win_Ypos



PixelGetColor, color, xpos, ypos, RGB


GetKeyState, state, F2
if state = D
{

CenterX := Floor(Xmax/2)
CenterY := Floor(Ymax/2)


if xpos > CenterX
{
offsetX := CenterX - xpos
} else {
offsetX := xpos - CenterX
}

if ypos > CenterY
{
offsetY := CenterY - ypos
} else {
offsetY := ypos - CenterY
}



Clipboard = Mouse Position: %xpos%`, %ypos%`n`nScreen Center: %CenterX%, %CenterY%`nMouse Position Offset: %offsetX%, %offsetY%`n`nColor: %color%`nActive Window: %Title%`nWindows Resolution: %A_ScreenWidth%x%A_ScreenHeight%


MsgBox Mouse Position: %xpos%, %ypos%`n`nScreen Center: %CenterX%, %CenterY%`nMouse Position Offset: %offsetX%, %offsetY%`n`nColor: %color%`n`nThis information has been saved to the clipboard.`nPaste into Notepad with Ctrl+V at anytime.
}

ToolTip, Mouse Position: %xpos%`, %ypos%`n`nColor: %color%`n`nActive Window: %Title%`n`nWindows Resolution: %A_ScreenWidth%x%A_ScreenHeight%`n`nAHK Windows Resolution: %XMax%x%YMax%


return

^r::reload
^p::Pause