Click LButton to record Coordinates Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dasmexyboi
Posts: 1
Joined: 23 May 2017, 22:44

Click LButton to record Coordinates

23 May 2017, 22:57

Code: Select all

#SingleInstance, Force

Gui, Add, Edit, ReadOnly vcoords w100 h20 gcoord

Gui, Color, Black
Gui, +AlwaysOnTop
Gui, Show, x1200 w500 h500, Coordinates
return

KeyWait, LButton, D
msgbox You clicked
return

coord:
	return
So what I'm trying to do is make a GUI with a read only textbox so that when I click the Left Mouse Button, it takes the coordinates of the mouse and records it on the textbox
This is what I have so far
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Click LButton to record Coordinates  Topic is solved

23 May 2017, 23:49

Code: Select all

#SingleInstance, Force

Gui, Add, Edit,cwhite ReadOnly vcoords w100 h20 
Gui, Color, Black
Gui, +AlwaysOnTop
Gui, Show, x1200 w500 h500, Coordinates
return

#ifwinactive ahk_exe AutoHotkey.exe ; so it only works while your gui is active or you get stuck without being able to click anything
+lbutton::
	mousegetpos,mx,my
	guicontrol, ,edit1, %mx% , %my%
return
Nightwolf85
Posts: 302
Joined: 05 Feb 2017, 00:03

Re: Click LButton to record Coordinates

24 May 2017, 08:30

Alt option, that doesn't require the GUI to be active, and sets the CoordMode to screen.

Code: Select all

#SingleInstance Force

CoordMode, Mouse, Screen
Gui, Add, Edit,cwhite ReadOnly vcoords w100 h20 
Gui, Color, Black
Gui, +AlwaysOnTop +toolwindow
Gui, Show,, Coordinates
Return

GUIClose:
ExitApp
Return

~LButton::
	MouseGetPos, mx, my
	GuiControl, , edit1, %mx% , %my%
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk and 94 guests