Page 1 of 1

### Draw Circle Like "Magic Formation"

Posted: 29 Jun 2019, 01:31
There's a small app I use called "Magic Formation". Info on this app can be found here:

It's actually a fantastic little program, kind of like the famous "Radial Menu" script we have here on the forums somewhere.

The thing I like about this Magic Formation thing is that to make the menu appear, all you need to do is draw a circle shape with the mouse. No mouse buttons, no clicking, just move the cursor in a clockwise circular direction to show the menu - and it is quite responsive (you can adjust the sensitivity also). Or, draw a counter-clockwise circle to hide the menu.

My question here is - might anyone know of a similar type of code, where all you need to do is draw a circle (or perhaps other shapes like a triangle or square) with the mouse (no buttons) to send a command?

### Re: Draw Circle Like "Magic Formation"

Posted: 29 Jun 2019, 03:16
working proof of concept.

Code: Select all

#SingleInstance Force
SetTimer,watch_mouse,100
Return
;~ GuiClose:
*ESC::
ExitApp

watch_mouse(){
static LX,LY,step:=0
MouseGetPos,cx,cy
if(Step=0){
Lx:=cx
Step:=1
}else if(lx-cx>100&&step=1){
step:=2
ly:=cy
}else if(cx-lx>1&&Step=1){
step:=0
}else if(ly-cy>100&&Step=2){
Step:=3
lx:=cx
}else if(cy-ly>1&&Step=2){
Step:=0
}else if(cx-lx>100&&Step=3){
Step:=4
ly:=cy
}else if(lx-cx>1&&Step=3){
Step:=0
}else if(cy-ly>100&&Step=4){
Step=0
ShowGui()
SoundBeep,500
}else if(ly-cy>20&&Step=4){
step:=0
}
;~ ToolTip,% step
}

ShowGui(){
static ft
if(!ft){
ft:=1
Gui,+AlwaysOntop
}
MouseGetPos,gx,gy
Gui,Show,% "x" gx-100 " y" gy-50 "w200 h100 NA",Proof Of Concept
}

### Re: Draw Circle Like "Magic Formation"

Posted: 29 Jun 2019, 03:37
wow, this is incredible lol!!!

It's exactly the same thing as Magic Formation

I will keep playing with this in the morning. I think I can understand the code enough to adjust sensitivity settings.

I've been looking for ways to trigger commands using only mouse movements (I use a pen tablet), so finding ways to maybe draw a circle, square, triangle, etc to trigger an event (without pressing any buttons or keys) would be great.

I have an old script named MMHK.ahk which allowed for drawing mouse gestures without any buttons/keys, but for some reason this code locks up/freezes my mouse input, and I cannot use it - although I used to be able to use it years ago - I'm not sure why I can't use it now.

Nonetheless, i LOVE this code you provided here. I'll study it more in the morning to see what else I can do with it, perhaps finding ways to draw other shapes like triangle, square, or just move the mouse "up-down-up-down-up-down" to send a command, for example.

Thanks again Hellbent - chat tomorrow

### Re: Draw Circle Like "Magic Formation"

Posted: 29 Jun 2019, 03:40
Here is with a time factor added in.

Code: Select all

#SingleInstance Force
CoordMode, Mouse, Screen
SetTimer,watch_mouse,100
Return
;~ GuiClose:
*ESC::
ExitApp

watch_mouse(){
static LX,LY,step:=0,StartTime
MouseGetPos,cx,cy
if(Step=0){
Lx:=cx
Step:=1
StartTime:=A_TickCount
}else if(lx-cx>100&&step=1){
step:=2
ly:=cy
StartTime:=A_TickCount
}else if(cx-lx>1&&Step=1){
step:=0
}else if(ly-cy>100&&Step=2){
Step:=3
lx:=cx
}else if(cy-ly>1&&Step=2){
Step:=0
}else if(cx-lx>100&&Step=3){
Step:=4
ly:=cy
}else if(lx-cx>1&&Step=3){
Step:=0
}else if(cy-ly>100&&Step=4){
Step=0
ShowGui()
SoundBeep,500
}else if((ly-cy>1&&Step=4)||A_TickCount-StartTime>1000){
step:=0
}
;~ ToolTip,% step "`n" A_TickCount-StartTime
}

ShowGui(){
static ft
MouseGetPos,gx,gy
if(!ft){
ft:=1
Gui,+AlwaysOntop
Gui,Show,% "x" gx-100 " y" gy-50 "w200 h100 NA",Proof Of Concept
}
Gui,Show,% "x" gx-100 " y" gy-50 " NA"
}

### Re: Draw Circle Like "Magic Formation"

Posted: 30 Jun 2019, 12:01
excellent - this also seems to work if you draw a square, as well !