Script to draw a tiny circle
-
- Posts: 16
- Joined: 22 Feb 2023, 11:28
Script to draw a tiny circle
i want to create a script that draws a tiny red circle (say 5x5 pixels) in the current position of the cursor every time I press the the R key, and deletes every circle when I press D. I want them not to disappear when I click or navigate through windows. If someone can help with that I'd appreciate it, thanks!
Re: Script to draw a tiny circle
Code: Select all
#Requires AutoHotkey v2.0
g := []
r:: {
g.Push f := Gui('+AlwaysOnTop -DPIScale +LastFound -Caption')
f.AddPic 'AltSubmit', 'circle.gif'
WinSetTransColor f.BackColor := 'White'
CoordMode('Mouse'), MouseGetPos(&x, &y), f.Show('x' x - 13 ' y' y - 6)
}
d:: {
For f in g
f.Destroy
Global g := []
}
- Attachments
-
- Circle
- circle.gif (92 Bytes) Viewed 365 times
-
- Posts: 16
- Joined: 22 Feb 2023, 11:28
Re: Script to draw a tiny circle
mikeyww wrote: ↑15 May 2024, 20:35Code: Select all
#Requires AutoHotkey v2.0 g := [] r:: { g.Push f := Gui('+AlwaysOnTop -DPIScale +LastFound -Caption') f.AddPic 'AltSubmit', 'circle.gif' WinSetTransColor f.BackColor := 'White' CoordMode('Mouse'), MouseGetPos(&x, &y), f.Show('x' x - 13 ' y' y - 6) } d:: { For f in g f.Destroy Global g := [] }
Ok so it kinda worked, but it creates a new window every time I create a new circle and I need to have the image, it looks horrible both in gif and png format, and I had to adjust the position until I matched my cursor. However, someone gave me another script on Reddit and it's almost perfect for what I want, but I have to adjust the position and I don't know how. Could you please help me with that? I just need to know where to change the X and Y axes and I'll do the rest.
Code: Select all
*r::show_mouse(1),KeyWait('r')
*d::show_mouse(0),KeyWait('d')
show_mouse(state) {
static size := 5
static color := 'Red'
static goos := []
if (!state) {
if IsSet(goos) {
for index, goo in goos
goo.Destroy()
,goos := unset
} return
}
if !IsSet(goos)
goos := []
CoordMode('Mouse', 'Screen')
MouseGetPos(&mx, &my)
goo := Gui('-Caption +ToolWindow +AlwaysOnTop +E0x20')
goos.Push(goo)
goo.BackColor := 0x1
goo.AddProgress('x' (mx-size/2) ' y' (my-size/2) ' w' size ' h' size ' Background' color, 0)
goo.Show('x0 y0 w1 h1 NoActivate')
WinSetTransColor(0x1, 'ahk_id ' goo.hwnd)
goo.Move(0, 0, A_ScreenWidth, A_ScreenHeight)
}
Esc::Exitapp
Re: Script to draw a tiny circle
I would look at the AddProgress line where the x and y values are specified.