23 February 2013

How to get current mouse position coordinates? You can create a simple script that shows a message box with coordinates on key-press.

Source code viewer
  1. ; F10 triggers the coordinates message box.
  2. HotKeySet("{F10}", "mouse_pos")
  3.  
  4. Func mouse_pos()
  5. $pos = MouseGetPos()
  6. MsgBox(0,"Your mouse pointer coordinate is:", $pos[0]&"x"&$pos[1])
  7.  
  8. ;----------------------------------------------------------------------------------------------------
  9.  
  10. ; Shows ToolTip with mouse position. F10 quits the scripts.
  11. HotKeySet("{F10}", "quit")
  12.  
  13. $pos = MouseGetPos()
  14. ToolTip($pos[0]&"x"&$pos[1])
  15. Sleep(100)
  16.  
  17. Func quit()
Programming Language: AutoIt