Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

like gestures, but better (I think)


  • Please log in to reply
11 replies to this topic
kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
in few words this is a context sensitive radial menu.When you press the middle mouse button the menu appears centered on the mouse cursor.Then you can select what to do by making the appropriate gesture whit the mouse.

try press and hold middle mouse button on mozilla
you will get this

Posted Image
and on my desktop:
Posted Image

In this image you can view the sensible areas. Where you release the mouse,this is the area relative to the action to be performed.
In this sense if you draw a "c" with middle mouse button, it is important only where you release the button(a little different from gestures,but for direction up,up+left,left,left+down,down,... it is the same).
Posted Image


Tell me what do you think about!!
:wink:

compile and place them all in the same folder

the script:


;author: Salvatore Romeo

vuota=

MButton::
MouseGetPos,,,idn
WinGetClass, class, ahk_id %idn%
IniRead, nloop, conf.ini, num_el, num, 20
Sleep,300
mb:=GetKeyState("MBUTTON","P")
if(mb="0")
MouseClick,M
else
{

Loop,%nloop%
{
indice_attuale=%A_Index%
IniRead, classe, conf.ini, pg%A_Index%, ahkclass
if(class=classe)
{
gosub,cleanvar
IniRead, up, conf.ini, pg%A_Index%, up
IniRead, ud, conf.ini, pg%A_Index%, ud
IniRead, dx, conf.ini, pg%A_Index%, dx
IniRead, dd, conf.ini, pg%A_Index%, dd
IniRead, dn, conf.ini, pg%A_Index%, dn
IniRead, ds, conf.ini, pg%A_Index%, ds
IniRead, sx, conf.ini, pg%A_Index%, sx
IniRead, us, conf.ini, pg%A_Index%, us
StringSplit, up, up, |
StringSplit, ud, ud, |
StringSplit, dx, dx, |
StringSplit, dd, dd, |
StringSplit, dn, dn, |
StringSplit, ds, ds, |
StringSplit, sx, sx, |
StringSplit, us, us, |
break
}
}



MouseGetPos,x,y
ToolTip,%up1%,x-20,y-100,1
ToolTip,%ud1%,x+50,y-70,2
ToolTip,%dx1%,x+80,y,3
ToolTip,%dd1%,x+50,y+70,4
ToolTip,%dn1%,x-20,y+100,5
ToolTip,%ds1%,x-90,y+70,6
ToolTip,%sx1%,x-120,y,7
ToolTip,%us1%,x-90,y-70,8
SetTimer, dove, 400
}
return



dove:
xb1:=GetKeyState("MBUTTON","P")
if(xb1=1)
{

return
}
else
{
ToolTip,,,,1
ToolTip,,,,2
ToolTip,,,,3
ToolTip,,,,4
ToolTip,,,,5
ToolTip,,,,6
ToolTip,,,,7
ToolTip,,,,8

SetTimer, dove, Off  ; i.e. the timer turns itself off here.
MouseGetPos,xd,yd 
if(xd>x-50 and xd<x+50 and yd>y-1000 and yd<y-20)        ;up
{
Send,%up2%
Run,%up3%
}
else if(xd>x+60 and yd<y-60)                          ;ud
{
Send,%ud2%
Run,%ud3%
}
else if(xd>x+20 and xd<x+1000 and yd>y-50 and yd<y+50)   ;dx
{
Send,%dx2%
Run,%dx3%
}
else if(xd>x+60 and yd>y+60)                          ;dd
{
Send,%dd2%
Run,%dd3%
}
else if(xd>x-50 and xd<x+50 and yd>y+20 and yd<y+1000)   ;dn
{
Send,%dn2%
Run,%dn3%
}
else if(xd<x-60 and yd>y+60)                          ;ds
{
Send,%ds2%
Run,%ds3%
}
else if(xd>x-1000 and xd<x-20 and yd>y-50 and yd<y+50)   ;sx
{
Send,%sx2%
Run,%sx3%
}
else if(xd<x-60 and yd<y-60)                          ;us
{
Send,%us2%
Run,%us3%
}


}
return

cleanvar:
up=%vuota%
ud=%vuota%
dx=%vuota%
dd=%vuota%
dn=%vuota%
ds=%vuota%
sx=%vuota%
us=%vuota%
up1=%vuota%
ud1=%vuota%
dx1=%vuota%
dd1=%vuota%
dn1=%vuota%
ds1=%vuota%
sx1=%vuota%
us1=%vuota%
up1=%vuota%
ud1=%vuota%
dx1=%vuota%
dd1=%vuota%
dn1=%vuota%
ds1=%vuota%
sx1=%vuota%
us1=%vuota%
up2=%vuota%
ud2=%vuota%
dx2=%vuota%
dd2=%vuota%
dn2=%vuota%
ds2=%vuota%
sx2=%vuota%
us2=%vuota%
up3=%vuota%
ud3=%vuota%
dx3=%vuota%
dd3=%vuota%
dn3=%vuota%
ds3=%vuota%
sx3=%vuota%
us3=%vuota%
return


#c::
MouseGetPos,,,idn
WinGetClass, class, ahk_id %idn% 
msgbox,ahk: %class% `n Salvata negli appunti
Clipboard=%class%
return

#x::
Run,gesture.exe
return


the conf.ini file:

[num_el]
num=4

[pg1]
nomec=Xplorer2
ahkclass=ATL:ExplorerFrame
up=Doppio Pannello|^o|
ud=Anteprima|^q|
dx=Cambia Tipo|^{F2}|
dd=Nuova Scheda|^{Ins}|
dn=Cartelle Recenti|!{F2}|
ds=Chiudi Scheda|^{F4}|
sx=Seleziona Tutto|^a|
us=Aggiorna|^r|

[pg2]
nomec=PsPad
ahkclass=TfPSPad
up=Salva|^s|
ud=Salva Come|{F12}|
dx=Run|{F9}|
dd=Help di AHK||E:\programmi\AutoHotkey\AutoHotkey.chm
dn=Nuovo|^n|
ds=Apri|^o|
sx=Stampa|^p|
us=Trova|^f|

[pg3]
nomec=Desktop
ahkclass=progman
up=E:\||e:\
ud=Incoming||e:\programmi\emule\incoming
dx=Blocco Note||notepad.exe
dd=Help di AHK||E:\programmi\AutoHotkey\AutoHotkey.chm
dn=xplorer||e:\programmi\xplorer2_lite\xplorer2.exe
ds=firefox||d:\Programmi\Mozilla firefox\firefox.exe
sx=Cartella programmi||e:\programmi
us=kiu||E:\programmi\kiu_theme

[pg4]
nomec=Firefox
ahkclass=MozillaUIWindowClass
up=Schermo Intero|{F11}|
ud=Segnalibri|^b|
dx=ScrapBook|!k|
dd=Estensioni|^+e|
dn=Barra Laterale|{F4}|
ds=Stampa|^p|
sx=Ricarica|^r|
us=Downloads|^+d|

the gui:


;Author: Salvatore Romeo

dir0=8
dir1=up
dir2=ud
dir3=dx
dir4=dd
dir5=dn
dir6=ds
dir7=sx
dir8=us


gosub,creaGui

Return

GuiClose:
ExitApp

lista:
Loop,%nloop%
{
temp=obj%A_Index%
if(A_GuiControl=%temp%)
ind=%A_Index%
}

Loop,8
{
dir_att=%A_Index%
di:=dir%A_Index%
IniRead, t%di%, conf.ini, pg%ind%, %di%
StringSplit, t%di%, t%di%, |
Loop,3
{
tem:=t%di%%A_Index%
GuiControl,,%di%%A_Index%, %tem%
}
}
IniRead, nC, conf.ini, pg%ind%, ahkclass
GuiControl,,nClass, %nC%
GuiControl,,className,%A_GuiControl%
return

ButtonNew:
msgbox,Click with "left win" button on the program you want
KeyWait, LWin ,D
MouseGetPos,,,idn
WinGetClass, class, ahk_id %idn% 
Loop,%nloop%
{
t:=objc%A_Index%
if(t=class)
{
IniRead, clas, conf.ini, pg%A_Index%, nomec
msgbox,This class already exist with name "%clas%"".Change the existing one
return
}
}
msgbox,ok
next:=nloop+1
IniWrite, %next%, conf.ini, num_el,num
IniWrite, %class% , conf.ini, pg%next%,ahkclass 
InputBox, nomeClasse, Insert Name, Insert the name of the program, , , , , , , , 

IniWrite, %nomeClasse% , conf.ini, pg%next%,nomeC
Loop,8
{
dix:=dir%A_Index%
IniWrite, %A_Space%, conf.ini, pg%next%, %dix%
}

Gui,destroy
gosub,creaGui
return

ButtonUpdate:
Loop,%nloop%
{
temp=obj%A_Index%
if(A_GuiControl=%temp%)
ind=%A_Index%
}
if(ind=)
return
Gui, Submit, NoHide
Loop,8
{
dix:=dir%A_Index%
dix1:=%dix%1
dix2:=%dix%2
dix3:=%dix%3
valore=%dix1%|%dix2%|%dix3%
IniWrite,%valore% , conf.ini, pg%ind%, %dix%
}
IniWrite,%nClass% , conf.ini, pg%ind%, ahkclass
IniWrite,%className% , conf.ini, pg%ind%, nomec
return

creaGui:

oggettiLista=
IniRead, nloop, conf.ini, num_el, num, 20
Loop,%nloop%
{
IniRead, classe, conf.ini, pg%A_Index%, nomec
IniRead, objclass, conf.ini, pg%A_Index%, ahkclass
oggettiLista=%oggettiLista%|%classe%
obj%A_Index%=%classe%
objc%A_Index%=%objclass%
}
Gui, Add, DropDownList, gLista x1 y1 , %oggettiLista%
Gui,add,Edit,x200 y1 w40 h20 vclassName
Gui,add, Edit,x400 y1 vnClass,%nClass%
Gui, add,Text,x350 y5 ,Class
Gui, Add, Text, x186 y24 w40 h20, Nome  
Gui, Add, Text, x36 y84 w40 h20, Nome
Gui, Add, Text, x6 y184 w40 h20, Nome
Gui, Add, Text, x36 y284 w40 h20, Nome
Gui, Add, Text, x186 y334 w40 h20, Nome
Gui, Add, Text, x346 y274 w40 h20, Nome
Gui, Add, Text, x386 y184 w40 h20, Nome
Gui, Add, Text, x346 y84 w40 h20, Nome   
Gui, Add, Text, x36 y104 w40 h20, Send
Gui, Add, Text, x6 y204 w40 h20, Send
Gui, Add, Text, x36 y304 w40 h20, Send
Gui, Add, Text, x186 y354 w40 h20, Send
Gui, Add, Text, x346 y294 w40 h20, Send
Gui, Add, Text, x386 y204 w40 h20, Send
Gui, Add, Text, x346 y104 w40 h20, Send
Gui, Add, Text, x186 y44 w40 h20, Send
Gui, Add, Text, x36 y124 w40 h20, Run
Gui, Add, Text, x6 y224 w40 h20, Run
Gui, Add, Text, x36 y324 w40 h20, Run
Gui, Add, Text, x186 y374 w40 h20, Run
Gui, Add, Text, x346 y314 w40 h20, Run
Gui, Add, Text, x386 y224 w40 h20, Run
Gui, Add, Text, x346 y124 w40 h20, Run
Gui, Add, Text, x186 y64 w40 h20, Run  
Gui, Add, Edit, x226 y24 w100 h20  vup1 ,%tup1%
Gui, Add, Edit, x226 y44 w100 h20  vup2 ,%tup2%
Gui, Add, Edit, x226 y64 w100 h20  vup3 ,%tup3%
Gui, Add, Edit, x386 y84 w100 h20  vud1 ,%tud1%
Gui, Add, Edit, x386 y104 w100 h20 vud2 ,%tud2%
Gui, Add, Edit, x386 y124 w100 h20 vud3 ,%tud3%
Gui, Add, Edit, x426 y184 w100 h20 vdx1 ,%tdx1%
Gui, Add, Edit, x426 y204 w100 h20 vdx2 ,%tdx2%
Gui, Add, Edit, x426 y224 w100 h20 vdx3 ,%tdx3%
Gui, Add, Edit, x386 y274 w100 h20 vdd1 ,%tdd1%
Gui, Add, Edit, x386 y294 w100 h20 vdd2 ,%tdd2%
Gui, Add, Edit, x386 y314 w100 h20 vdd3 ,%tdd3%
Gui, Add, Edit, x226 y334 w100 h20 vdn1 ,%tdn1%
Gui, Add, Edit, x226 y354 w100 h20 vdn2 ,%tdn2%
Gui, Add, Edit, x226 y374 w100 h20 vdn3 ,%tdn3%
Gui, Add, Edit, x76 y284 w100 h20  vds1 ,%tds1%
Gui, Add, Edit, x76 y304 w100 h20  vds2 ,%tds2%
Gui, Add, Edit, x76 y324 w100 h20  vds3 ,%tds3%
Gui, Add, Edit, x46 y184 w100 h20  vsx1 ,%tsx1%
Gui, Add, Edit, x46 y204 w100 h20  vsx2 ,%tsx2%
Gui, Add, Edit, x46 y224 w100 h20  vsx3 ,%tsx3%
Gui, Add, Edit, x76 y84 w100 h20   vus1 ,%tus1%
Gui, Add, Edit, x76 y104 w100 h20  vus2 ,%tus2%
Gui, Add, Edit, x76 y124 w100 h20  vus3 ,%tus3%

Gui, Add, Button,x240 y170 h30 w60 ,&New
Gui, Add, Button,x210 y202 h30 w120 ,&Update

Gui, Show, x300 y110 h400 w550, Gestures Generator
return






:wink: :wink: :wink: :roll: :roll: :roll:

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Looks interesting. Although you may have intentionally left it a little mysterious, you might get more people to try it if you give a summary/overview at the top about its benefits and features.

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
this is the gui that you can call pressing win+x when the first script is running and there is a file called gesture.exe compiled from the second script.

Posted Image

when you select a program (up-left) the gui updates
Posted Image

you can personalize the menu for the program changing the corrisponding voices and pressing the update button.
to add a new menù for a program select new,press ok,press lwin on the program to add.Press ok and a new voice appears in the list.
You can modify the menu like i descrive above

evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005
Thanks for posting your script - I think it's quite an interesting alternative, using the circular arrangement of tolltips, compared to mouse gestures alone.

Terrapin
  • Members
  • 107 posts
  • Last active: Feb 06 2007 03:38 PM
  • Joined: 15 Aug 2005
I was hesitant to try it with the mystery. I am glad you posted the explanation and the screen-shots. It looks very nice. Thanks for your work! And sharing it.

I am going to try it now. :)

Bob
When it comes to Binary, there are 10 types of people. Those who get it and those who don't. :)

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
gui updated,conf.ini updated:now you can name the program and the class separatly and in the list you see the names only

this is the function to assign a menu to a button
in this exemple in the conf.ini there is a section my1 like this:

[my1]
up=hotmail|hotmail.com|
ud=blender.it||www.blender.it
dx=kino3d||www.kino3d.com
dd=
dn=
ds=Stampa|^p|
sx=Ricarica|^r|
us=

and now the code(press and hold c, move the mouse,release c and voilà)

$c::
makeGesture("c","my1")
return

makeGesture(key,menu)
{
global
k=%key%
Sleep,300
mb:=GetKeyState(key,"P")
if(mb="0")
Send,%key%
else
{
IniRead, up, conf.ini, %menu%, up
IniRead, ud, conf.ini, %menu%, ud
IniRead, dx, conf.ini, %menu%, dx
IniRead, dd, conf.ini, %menu%, dd
IniRead, dn, conf.ini, %menu%, dn
IniRead, ds, conf.ini, %menu%, ds
IniRead, sx, conf.ini, %menu%, sx
IniRead, us, conf.ini, %menu%, us
StringSplit, up, up, |
StringSplit, ud, ud, |
StringSplit, dx, dx, |
StringSplit, dd, dd, |
StringSplit, dn, dn, |
StringSplit, ds, ds, |
StringSplit, sx, sx, |
StringSplit, us, us, |
}

MouseGetPos,x,y
ToolTip,%up1%,x-20,y-100,1
ToolTip,%ud1%,x+50,y-70,2
ToolTip,%dx1%,x+80,y,3
ToolTip,%dd1%,x+50,y+70,4
ToolTip,%dn1%,x-20,y+100,5
ToolTip,%ds1%,x-90,y+70,6
ToolTip,%sx1%,x-120,y,7
ToolTip,%us1%,x-90,y-70,8
gosub,dove
}

dove:
xb1:=GetKeyState(k,"P")
if(xb1="1")
{
sleep,300
gosub,dove
}
else
{
ToolTip,,,,1
ToolTip,,,,2
ToolTip,,,,3
ToolTip,,,,4
ToolTip,,,,5
ToolTip,,,,6
ToolTip,,,,7
ToolTip,,,,8
SetTimer, dove, Off  ; i.e. the timer turns itself off here.
MouseGetPos,xd,yd 
if(xd>x-50 and xd<x+50 and yd>y-1000 and yd<y-20)        ;up
{
Send,%up2%
Run,%up3%
}
else if(xd>x+60 and yd<y-60)                          ;ud
{
Send,%ud2%
Run,%ud3%
}
else if(xd>x+20 and xd<x+1000 and yd>y-50 and yd<y+50)   ;dx
{
Send,%dx2%
Run,%dx3%
}
else if(xd>x+60 and yd>y+60)                          ;dd
{
Send,%dd2%
Run,%dd3%
}
else if(xd>x-50 and xd<x+50 and yd>y+20 and yd<y+1000)   ;dn
{
Send,%dn2%
Run,%dn3%
}
else if(xd<x-60 and yd>y+60)                          ;ds
{
Send,%ds2%
Run,%ds3%
}
else if(xd>x-1000 and xd<x-20 and yd>y-50 and yd<y+50)   ;sx
{
Send,%sx2%
Run,%sx3%
}
else if(xd<x-60 and yd<y-60)                          ;us
{
Send,%us2%
Run,%us3%
}


}
return

cleanvar:
up=%vuota%
ud=%vuota%
dx=%vuota%
dd=%vuota%
dn=%vuota%
ds=%vuota%
sx=%vuota%
us=%vuota%
up1=%vuota%
ud1=%vuota%
dx1=%vuota%
dd1=%vuota%
dn1=%vuota%
ds1=%vuota%
sx1=%vuota%
us1=%vuota%
up1=%vuota%
ud1=%vuota%
dx1=%vuota%
dd1=%vuota%
dn1=%vuota%
ds1=%vuota%
sx1=%vuota%
us1=%vuota%
up2=%vuota%
ud2=%vuota%
dx2=%vuota%
dd2=%vuota%
dn2=%vuota%
ds2=%vuota%
sx2=%vuota%
us2=%vuota%
up3=%vuota%
ud3=%vuota%
dx3=%vuota%
dd3=%vuota%
dn3=%vuota%
ds3=%vuota%
sx3=%vuota%
us3=%vuota%
return

return




Terrapin
  • Members
  • 107 posts
  • Last active: Feb 06 2007 03:38 PM
  • Joined: 15 Aug 2005
I did try it, and figured some things out. I think it needs some documentation however. I don't believe (but not sure) there is a way to put a '?' on your GUI title bar, that would be nice. Maybe you could make some right-click context menus? Or, a doc screen which comes up when the GUI is launched, with a checkbox 'Don't show this any more.' ?

And, not being able to read Italian, there are sadly some hints I cannot get.

If you have not corrected this: I ran across having accidentally created a NEW, twice for the same class. The program stored my tooltips in the 2nd, but seemed to be trying to retrieve them from the first. I deleted the first from the ini file, and it worked fine then.

Thanks again, I would love to see it developed further.

Bob
When it comes to Binary, there are 10 types of people. Those who get it and those who don't. :)

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
update: if the class already exists it alerts you

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
i'm working to add the possibility to define menu with a hotkey.
I'll add this function in the same gui

I know that all things can be a little confusing now,but i will organize all in the next few days

Rainy-Day
  • Members
  • 55 posts
  • Last active: Nov 06 2006 04:40 PM
  • Joined: 01 Jan 2006
I tried it, but I couldn't understand how it works. I think, however, the idea is very good, and indeed better than gestures, as you say.

One problem I see is that tooltips show up very slowly. They should show up instantly. Secondly, wheel is not very easy to press on many mice, so I 'd prefer right mouse click, and if you hold it without moving for half a second, you'd get a regular menu. Or maybe a bit longer, .7 second?

What I was thinking about before, and what seems fairly close to what you're doing, is this: you bring up a menu of choices around the mouse, perhaps a bunch of icons (even better than tooltips, 'cause you'd be able to fit in many more of them in a circle), and then when you move the mouse closer to one of them, it highlights. For instance, if one of them is in the north and the next one in north-east, moving the mouse upward will highlight the north one, and shifting it to the right OR moving it up-right from the start, highlights the north-east tooltip. Once you release the mouse, highlighted item runs.

The idea is of course that gestures are hard to remember, and when you're doing a fairly complex gesture, you can't be certain you'll get it right - or, at least, you have to be careful as you do it. You dont' have a visual confirmation.

With this method you have all the advantages of gestures, and on top of that you can have many of them, and you'll be certain the one you selected is the one that will run.
-AK

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
update:take a look at the new post
Radial Menu and rocket gestures

RainyDay
  • Guests
  • Last active:
  • Joined: --
When I activate the menu, a large black window appears, the size is about 480 x 640. Then menu slowly appears over that window. Cursors do not change over buttons here.. Perhaps I need special cursors installed? If I understood a previous post right, black window appears only if you don't have proper icons installed? If so, could you please include icons and cursors into the distribution?

Another small issue: tooltips appear very slowly and not all at the same time, which makes the last tooltip to appear even slower. It would be cool if they all appeared instantly and quickly.

I'm glad to see images there that follow my idea of radial buttons, but they aren't used in the program yet? Thanks! This program looks very promising.