Radial menu scripts

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: Radial menu scripts

04 Mar 2016, 07:11

Here are some
HTML-AHK radial menus
Image
This technique allows you to use the power of AutoHotkey combined with Javascript, HTML, CSS and GDI+. There are many HTML/CSS/JS based radial menus/circular navigation bars on the web. This technique shows how to "get them out of browser" and combine with AutoHotkey. You can also insert HTML UI in such radial menus; on/off switches, text areas, sliders, etc. Here is the picture which explains the drawing process and the scripts (unpolished & hardcoded for now). You'll have to include Gdip.ahk in the script. Pressing F1 shows/hides menu. Tested on Windows 10.

Pie type

Code: Select all

/*==Description=========================================================================
HTML-AHK pie type radial menu example by Learning one
https://autohotkey.com/boards/viewtopic.php?p=74494#p74494
Press F1 to show/hide menu. Tested on Windows 10.
*/
 
 
;===Auto-execute========================================================================
html = 
(`%
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><meta http-equiv="X-UA-Compatible" content="IE=Edge"></head>
 
<style>
.SVGRM {
  width: 200px;
  height: 200px;
  fill: #6666aa;
 
  /* border: 1px solid red; */
}
 
.SVGArc:hover {
  fill: #7777ff;
}
 
.ArcText {
  width: 50px;
  height: 50px;
  position: fixed;
  text-align: center;
  align-items: center;
  display: flex;
  justify-content: center;
  font-size: 11px;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0px;
  padding: 0px;
  position: fixed;
  color: white;
  pointer-events: none;
  /* border: 1px solid red; */
 
}
</style>
 
<svg class="SVGRM" viewBox="0 0 200 200" transform="translate(111,111)">
  <g transform="translate(-7,-7)">
    <ellipse class="SVGArc" id="SVGArc0"  cx="100" cy="100" rx="33" ry="33"
    />
    <path class="SVGArc" id="SVGArc1" d="m 0.99999372,95.680191 c 0,-1.1579 0.27259638,-4.43539 0.60581058,-7.283324 C 4.9151368,60.108904 20.32805,34.587891 43.916474,18.337932 c 2.12355,-1.462923 4.018697,-2.659734 4.211421,-2.659734 0.192832,0 7.181311,11.831985 15.529833,26.293212 l 15.179403,26.293312 -1.164824,0.827442 c -1.90376,1.352538 -6.47264,5.859909 -8.149007,8.039394 -3.605046,4.686858 -6.361592,11.305107 -7.255859,17.420633 l -0.472913,3.23314 -30.397208,0 -30.39732628,0 0,-2.10514 z"
    />
    <path class="SVGArc" id="SVGArc2" d="M 67.787572,39.550563 C 59.474859,25.144479 52.673658,13.236561 52.673658,13.088556 c 0,-0.46233 9.611564,-4.8526829 13.993274,-6.3918359 25.027428,-8.7914971 51.896518,-7.3728271 76.071828,4.0166279 2.4988,1.177209 4.48164,2.322243 4.40629,2.544498 -0.0759,0.222255 -6.8966,12.127104 -15.15844,26.455275 -10.99449,19.067401 -15.18246,26.001658 -15.62217,25.866721 -0.3305,-0.101376 -1.85334,-0.656667 -3.38423,-1.234035 -8.36358,-3.154635 -18.716008,-3.065535 -26.805526,0.23067 -1.571565,0.640332 -2.950982,1.164933 -3.065297,1.165725 -0.114434,7.92e-4 -7.00921,-11.785455 -15.321815,-26.191639 z"
    />
    <path class="SVGArc" id="SVGArc3" d="m 137.99517,97.437351 c 0,-0.19147 -0.26455,-1.85863 -0.5879,-3.70488 -0.64785,-3.69894 -2.01377,-8.007911 -3.41527,-10.774169 -2.35186,-4.642011 -7.0943,-10.244718 -11.58558,-13.687047 L 121.03801,68.22235 136.2029,41.950224 c 8.34059,-14.449644 15.28738,-26.272026 15.43716,-26.272026 0.58133,0 6.37383,4.019895 10.18916,7.071174 16.82779,13.457862 29.17393,32.758408 34.19374,53.454358 1.48217,6.111072 2.3472,11.636658 2.70433,17.275991 l 0.2727,4.30561 -30.50235,0 c -17.00272,0 -30.50247,-0.15404 -30.50247,-0.34798 z"
    />
    <path class="SVGArc" id="SVGArc4" d="m 136.47912,158.51193 c -8.19284,-14.18254 -14.99654,-26.04809 -15.11934,-26.36796 -0.1422,-0.37045 0.34849,-0.97792 1.35108,-1.6726 2.23186,-1.54648 6.84176,-6.42342 8.74857,-9.25541 3.15412,-4.68448 5.13707,-9.77368 6.12549,-15.72051 l 0.48265,-2.90377 30.46451,0 30.4644,0 -0.27407,4.10533 c -1.23076,18.43747 -7.91413,36.72594 -18.94817,51.84987 -4.47416,6.13255 -10.41734,12.44163 -16.39169,17.40083 -3.87062,3.21305 -11.03472,8.35065 -11.64449,8.35065 -0.19952,0 -7.06609,-11.60389 -15.25894,-25.78643 z"
    />
    <path class="SVGArc" id="SVGArc5" d="m 91.528941,198.66633 c -5.803598,-0.46886 -14.215905,-2.06157 -19.754163,-3.74012 -8.682073,-2.63132 -19.36647,-7.35619 -18.970153,-8.38896 0.188536,-0.49114 29.863242,-51.96362 30.110118,-52.22755 0.06346,-0.0683 1.222492,0.34244 2.575505,0.91189 8.633909,3.6335 19.496972,3.69765 28.384452,0.1676 1.64544,-0.65349 3.03595,-1.13602 3.08988,-1.07217 0.31905,0.37749 30.24381,52.38308 30.24381,52.56 0,0.36224 -6.14419,3.33006 -10.42211,5.03415 -14.34949,5.71606 -29.72094,8.01048 -45.257339,6.75516 z"
    />
    <path class="SVGArc" id="SVGArc6" d="M 43.861064,181.62358 C 23.027503,167.13206 8.6887689,145.8725 3.2537286,121.41624 2.1250494,116.33714 0.99999372,107.99579 0.99999372,104.70632 l 0,-2.11464 30.41884928,0 30.418849,0 0.255262,1.90248 c 0.809978,6.03514 3.442576,12.84308 6.751582,17.46014 1.757488,2.45203 6.601221,7.35233 8.830256,8.93317 l 1.16721,0.82783 -15.182235,26.29153 c -8.350224,14.46034 -15.364652,26.2853 -15.587728,26.27757 -0.223087,-0.01 -2.118006,-1.20502 -4.210975,-2.66082 z"
    />
  />
</svg>
 
<p class="ArcText" id="ArcText1" style="top: 42px; left: 18px;">Notepad</p>
<p class="ArcText" id="ArcText2" style="top: 9px; left: 75px;">Calc</p>
<p class="ArcText" id="ArcText3" style="top: 42px; left: 132px;">Change style</p>
<p class="ArcText" id="ArcText4" style="top: 108px; left: 132px;">Item 4</p>
<p class="ArcText" id="ArcText5" style="top: 141px; left: 75px;">Item 5</p>
<p class="ArcText" id="ArcText6" style="top: 108px; left: 18px;">Item 6</p>
 
<p class="ArcText" id="ArcText0" style="top: 75px; left: 75px;">x</p>
 
</body></html>
)
 
Size := 202, SizeAdd := 216
 
;=== ActiveX, WinSet Region ===
Gui, New, +HwndhGui
Gui %hGui%: +ToolWindow -Caption +AlwaysOnTop
Gui %hGui%:Add, ActiveX,  x0 y0 w%Size% h%Size% vwb, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
document := WB.Document
document.write(html)
DetectHiddenWindows, on 
WinSet, Region, % "0-0 W" Size+1 " H" Size+1 " E", % "ahk_id " hGui
Gui %hGui%:Show, w%Size% h%Size% hide
ComObjConnect(document, "document_")
 
;=== GDI+ ===
Gui, New, +HwndhLayeredWin
Gui %hLayeredWin%:-Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui %hLayeredWin%:Show, hide
WinSet, ExStyle, +0x20, % "ahk_id " hLayeredWin	; click through style
 
pToken := Gdip_Startup()
hbm := CreateDIBSection(SizeAdd, SizeAdd), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc), Gdip_SetSmoothingMode(G, 4)
 
	;Paint
pBrush := Gdip_BrushCreateSolid(0xffffffff)
Gdip_FillEllipse(G, pBrush, 1, 1, SizeAdd-3, SizeAdd-3)
Gdip_DeleteBrush(pBrush)
pPen := Gdip_CreatePen(0xff6666aa, 4)
Gdip_DrawEllipse(G, pPen, 2, 2, SizeAdd-5, SizeAdd-5)
Gdip_DeletePen(pPen)
 
	;Update, Delete, Shutdown
UpdateLayeredWindow(hLayeredWin, hdc, (A_ScreenWidth-SizeAdd)//2, (A_ScreenHeight-SizeAdd)//2, SizeAdd, SizeAdd)
SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
 
;=== Show ===
ToggleShowMenu()
Return
 
;===Hotkeys=============================================================================
F1::ToggleShowMenu()
Escape::ExitApp
 
 
;===Functions===========================================================================
#Include Gdip_All.ahk	; credits: Tic, Rseding91, fincs. http://www.autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/page-72#entry533310
 
document_OnClick(document) {
	SelectedArcId := document.parentWindow.event.srcElement.id	; example: "SVGArc6"
	SelectedArcNum := SubStr(SelectedArcId, 7)	; example: "6"
	ArcText := document.getElementById("ArcText" SelectedArcNum).innerHTML
 
	if (ArcText = "Notepad") {
		Run, Notepad
		ToggleShowMenu()
	}
	else if (ArcText = "Calc") {
		Run, Calc
		ToggleShowMenu()
	}
	else if (ArcText = "x") {
		ToggleShowMenu()	
	}
	else if (ArcText = "Change style") {
		NewFontStyle := (document.getElementById("ArcText" SelectedArcNum).style.fontStyle = "italic") ? "normal" : "italic"
		document.getElementById("ArcText" SelectedArcNum).style.fontStyle := NewFontStyle
	}
}
 
ToggleShowMenu() {
	global hLayeredWin, hGui, Size, SizeAdd
	if (DllCall("IsWindowVisible", A_PtrSize ? "Ptr" : "UInt", hGui) = 1) {
		Gui %hLayeredWin%:Hide
		Gui %hGui%:Hide
	}
	else {
		CoordMode, Mouse, Screen
		MouseGetPos, x,y
		Gui %hLayeredWin%:Show, % "x" x-Round(SizeAdd/2) " y" y-Round(SizeAdd/2) " NA"
		Gui %hGui%:Show, % "x" x-Round(Size/2) " y" y-Round(Size/2) " NA"
	}	
}
Circle type

Code: Select all

/*==Description=========================================================================
HTML-AHK circle type radial menu example by Learning one
https://autohotkey.com/boards/viewtopic.php?p=74494#p74494
Press F1 to show/hide menu. Tested on Windows 10.
*/


;===Auto-execute========================================================================
html = 
(`%
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><meta http-equiv="X-UA-Compatible" content="IE=Edge"></head>

<style>
body {
    background-color: #6666aa;
}

.button {
width: 60px;
height: 60px;
padding: 0px;
text-align: center;
font-size: 11px;
margin: 2px;
cursor: pointer;
position: fixed;
background-color: #6666aa;
color: #ffffff;
border: 4px solid #ffffff;
border-radius: 50%;
box-shadow: 0px 0px 8px #111111;
}
.button:hover {
background-color: #7777ff;
}
.Central {
border: 0px;
box-shadow: none;
}
</style>

<body>
<button class="button Central" style="top: 105px; left: 105px;">x</button>
<button class="button" style="top: 105px; left: 51px;">Item</button>
<button class="button" style="top: 152px; left: 78px;">Item</button>
<button class="button" style="top: 152px; left: 132px;">Item</button>
<button class="button" style="top: 105px; left: 159px;">Change style</button>
<button class="button" style="top: 58px; left: 132px;">Notepad</button>
<button class="button" style="top: 58px; left: 78px;">Calc</button>
<button class="button" style="top: 105px; left: 1px;">Item</button>
<button class="button" style="top: 157px; left: 15px;">Item</button>
<button class="button" style="top: 195px; left: 53px;">Item</button>
<button class="button" style="top: 209px; left: 105px;">Item</button>
<button class="button" style="top: 195px; left: 157px;">Item</button>
<button class="button" style="top: 157px; left: 195px;">Item</button>
<button class="button" style="top: 105px; left: 209px;">Item</button>
<button class="button" style="top: 53px; left: 195px;">Item</button>
<button class="button" style="top: 15px; left: 157px;">Item</button>
<button class="button" style="top: 1px; left: 105px;">Item</button>
<button class="button" style="top: 15px; left: 53px;">Item</button>
<button class="button" style="top: 53px; left: 15px;">Item</button>

</body>
</html>
)

;=== ActiveX, WinSet Region ===
Gui, New, +HwndhGui
Gui %hGui%: +ToolWindow -Caption +AlwaysOnTop
Gui %hGui%:Add, ActiveX,  x2 y2 w276 h276 vwb, about:<!DOCTYPE html><meta http-equiv="X-UA-Compatible" content="IE=edge">
Gui %hGui%:Color, 6666aa
document := wb.Document
document.write(html)
DetectHiddenWindows, on 
WinSet, Region, 2-2 W276 H276 E, % "ahk_id " hGui
Gui %hGui%:Show, w280 w280 hide
ComObjConnect(document, "document_")

;=== GDI+ ===
Gui, New, +HwndhLayeredWin
Gui %hLayeredWin%:-Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui %hLayeredWin%:Show, hide
WinSet, ExStyle, +0x20, % "ahk_id " hLayeredWin	; click through style
w := 308, h := w

pToken := Gdip_Startup()
hbm := CreateDIBSection(w, h), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)
G := Gdip_GraphicsFromHDC(hdc), Gdip_SetSmoothingMode(G, 4)

	;Paint
pBrush := Gdip_BrushCreateSolid(0xff6666aa)
Gdip_FillEllipse(G, pBrush, 4, 4, w-10, h-10)
Gdip_DeleteBrush(pBrush)
pPen := Gdip_CreatePen(0xffffffff, 4)
Gdip_DrawEllipse(G, pPen, 11, 11, w-24, h-24)
Gdip_DeletePen(pPen)

	;Update, Delete, Shutdown
UpdateLayeredWindow(hLayeredWin, hdc, (A_ScreenWidth-w)//2, (A_ScreenHeight-h)//2, w, h)
SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)

;=== Show ===
ToggleShowMenu()
Return

;===Hotkeys=============================================================================
F1::ToggleShowMenu()
Escape::ExitApp


;===Functions===========================================================================
#Include Gdip_All.ahk	; credits: Tic, Rseding91, fincs. http://www.autohotkey.com/board/topic/29449-gdi-standard-library-145-by-tic/page-72#entry533310

document_OnClick(document) {
	InnerHTML := document.parentWindow.event.srcElement.innerHTML
	if (InnerHTML = "Notepad") {
		Run, Notepad
		ToggleShowMenu()
	}
	else if (InnerHTML = "Calc") {
		Run, Calc
		ToggleShowMenu()
	}
	else if (InnerHTML = "x") {
		ToggleShowMenu()	
	}
	else if (InnerHTML = "Change style") {
		NewFontStyle := (document.parentWindow.event.srcElement.style.fontStyle = "italic") ? "normal" : "italic"
		document.parentWindow.event.srcElement.style.fontStyle := NewFontStyle
	}
}

ToggleShowMenu() {
	global hLayeredWin, hGui, w, h
	if (DllCall("IsWindowVisible", A_PtrSize ? "Ptr" : "UInt", hGui) = 1) {
		Gui %hLayeredWin%:Hide
		Gui %hGui%:Hide
	}
	else {
		CoordMode, Mouse, Screen
		MouseGetPos, x,y
		Gui %hLayeredWin%:Show, % "x" x-w/2 " y" y-h/2 " NA"
		Gui %hGui%:Show, % "x" x-140 " y" y-140 " NA"
	}	
}
As Lexikos pointed out, this is something to explore; Developing a Gadget for Windows.
Last edited by Learning one on 15 Mar 2016, 14:16, edited 1 time in total.
Guest

Re: Radial menu scripts - new: HTML-AHK radial menu examples

05 Mar 2016, 06:59

Look interesting/promising! Glad to see you're still active with RM the best ahk script I used every days. Hope this time we could play with other menu shapes like menu bar with submenu, or squared menus.
Can't wait next updates!
Thanks L1 :crazy:
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts - new: HTML-AHK radial menu examples

05 Mar 2016, 07:38

Guest wrote:Look interesting/promising! Glad to see you're still active with RM the best ahk script I used every days. Hope this time we could play with other menu shapes like menu bar with submenu, or squared menus.
Can't wait next updates!
Thanks L1 :crazy:
Forgot to login: joefango
beeski
Posts: 18
Joined: 06 Feb 2014, 08:38

Re: Radial menu scripts - new: HTML-AHK radial menu examples

06 Mar 2016, 15:31

i have a RM-related concept in mind, and wondered if anyone could help or indeed confirm this is feasible. thank you very much. (i have a feeling i had seen something in a similar vein suggested in the legacy RM thread on the old forum, but i may just be dreaming.)

in any case, this is what i was thinking:

i would like to have a fixed hotkey dynamically assigned to execute a piece of AHK code based on the last-executed RM code / button. a simple example: the user calls up RM and uses one of its buttons to launch the notepad. from now on, pressing that [keyboard] hotkey will be launching the notepad. if we then use RM to open, say, chrome, that same hotkey will instead launch the same chunk of code used to execute chrome -- and so on.

thank you.
ozzii
Posts: 481
Joined: 30 Oct 2013, 06:04

Re: Radial menu scripts - new: HTML-AHK radial menu examples

07 Mar 2016, 08:08

@L1
In the Pie example I have the scrollbars vertical and horizontal.
How can I do to not have them?

Thanks in advance.
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: Radial menu scripts - new: HTML-AHK radial menu examples

15 Mar 2016, 14:30

@joefango: I'm glad you like it - thanks. I hope I'll find some free time to make further improvements...
@beeski: Do you mean this: "DoItOrSetup" radial menu?
@ozzii: I forgot ot mention I tested it on Windows 10... You have scrollbars? Try to add this inside html style tags;

Code: Select all

body {
    overflow:hidden;
}
Does it help?
ozzii
Posts: 481
Joined: 30 Oct 2013, 06:04

Re: Radial menu scripts - new: HTML-AHK radial menu examples

16 Mar 2016, 10:25

@L1
Now it's OK. Thanks
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts - new: HTML-AHK radial menu examples

25 Apr 2016, 03:13

Hello,

I get a shorcut to show a toolbar (made with many docks).
When I press F1 the toolbar is shown
Press again F1 the toolbar is hidden
It works fine

Code: Select all

F1::

IfWinActive, ahk_exe blender-app.exe
{
MouseGetPos, MyXpos, MyYpos
Toggle := !Toggle
If Toggle
	{
	RM2_Show(81,MyXpos-120,MyYpos-60)	;Selection
	RM2_Show(80,MyXpos-60,MyYpos-60)
	RM2_Show(70,MyXpos,MyYpos-60)
	RM2_Show(71,MyXpos+60,MyYpos-60)
	
	RM2_Show(75,MyXpos-120,MyYpos)		;Cursor
	RM2_Show(57,MyXpos-60,MyYpos)		;Camera
	RM2_Show(73,MyXpos,MyYpos)			;Zoom
	RM2_Show(77,MyXpos+60,MyYpos)		;Add Mesh
	
	RM2_Show(72,MyXpos-120,MyYpos+60)	;Snap
	RM2_Show(74,MyXpos-60,MyYpos+60)	;Snap Increment
	RM2_Show(76,440,200)
	
	RM2_Show(59,950,140)
	
	RM2_Show(84,1090,140)
	}
	Else If !Toggle
	RM2_ShowDocks()
	}
return
I decided to do that with a mouse gesture, so I created a function in My Functions.ahk.

Code: Select all

ActDeactBlenderToolbar()
{
MouseGetPos, MyXpos, MyYpos
Toggle := !Toggle
If Toggle
	{
	RM2_Show(81,MyXpos-120,MyYpos-60)	;Selection
	RM2_Show(80,MyXpos-60,MyYpos-60)
	RM2_Show(70,MyXpos,MyYpos-60)
	RM2_Show(71,MyXpos+60,MyYpos-60)
	
	RM2_Show(75,MyXpos-120,MyYpos)		;Cursor
	RM2_Show(57,MyXpos-60,MyYpos)		;Camera
	RM2_Show(73,MyXpos,MyYpos)			;Zoom
	RM2_Show(77,MyXpos+60,MyYpos)		;Add Mesh
	
	RM2_Show(72,MyXpos-120,MyYpos+60)	;Snap
	RM2_Show(74,MyXpos-60,MyYpos+60)	;Snap Increment
	RM2_Show(76,440,200)
	
	RM2_Show(59,950,140)
	
	RM2_Show(84,1090,140)
	}
	Else If !Toggle
	RM2_ShowDocks()
}
Then I call it with a mouse gesture:

Code: Select all

MGA_L() {
	IfWinActive, ahk_class GHOST_WindowClass
	ActDeactBlenderToolbar()
	return
}
The behavior is not the same, the toolbar is shown but when I press again to hide it, it is still showing again

Can someone help me ?
User avatar
metacognition
Posts: 117
Joined: 22 Oct 2014, 05:57
Location: Alaska
Contact:

Re: Radial menu scripts - new: HTML-AHK radial menu examples

25 Apr 2016, 03:27

I took one look at the license agreement and clicked "no". Because I respect the authors right to code ownership and license, I also respect L1 magnificent codes and posts... I just can't promise to check back twice a month to see if you've changed your license as the license agreement would expect. I also highly doubt others are abiding to this agreement or have even read it.

L1, I've never seen such an arbitrary license agreement, I find it intriguing and unique but also kind of offputting. Would you care to share on why and where you are coming from with the licensing? If not I fully understand.
Guest

Re: Radial menu scripts - new: HTML-AHK radial menu examples

13 May 2016, 02:26

i can not use the default mouse(or key) gesture to active the menu, when i am using Remote desktop from my mobile device to control my PC, neither simulate a [Key Down] by other script will working.

could someone help me, how exactly i can active the Radial Menu in Remote Desktop? is it possible to simulte a [RButton Down] in RM? seems not working.

Thanks!
User avatar
ivill
Posts: 124
Joined: 13 May 2016, 02:23

Re: Radial menu scripts - new: HTML-AHK radial menu examples

13 May 2016, 02:29

its my post above, i will post it again, in order i wont recieve reply notification


1 minute ago
i can not use the default mouse(or key) gesture to active the menu, when i am using Remote desktop from my mobile device to control my PC, neither simulate a [Key Down] by other script will working.

could someone help me, how exactly i can active the Radial Menu in Remote Desktop? is it possible to simulte a [RButton Down] in RM? seems not working.

Thanks!
Dubs
Posts: 23
Joined: 19 May 2016, 19:55

Re: Radial menu scripts - new: HTML-AHK radial menu examples

05 Jun 2016, 00:03

After reading what MetaCognition said, I decided to see what clicking "No" did. I have to admit your way with words is kind of aggressive, you should respect people's decision to decline for whatever reason instead of taking the opportunity to jab them.
Image
User avatar
metacognition
Posts: 117
Joined: 22 Oct 2014, 05:57
Location: Alaska
Contact:

Re: Radial menu scripts - new: HTML-AHK radial menu examples

06 Jun 2016, 16:45

Haha I know right? A real poet.
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: Radial menu scripts

09 Jun 2016, 06:45

@metacognition, Dubs: I was planning and still plan to change the license, but until then, if you don't like the license and/or MsgBox-es, simply don't use Radial menu.
Long time ago I offered collaborative RM development to the community, which also included possible license change. Others definitely helped me a lot in improving RM (thank you all) but unfortunately, real collaborative development didn't happen. The result was that I had to to tons of things alone (writing a RM code is just one of them), without previous experience, and without any official programming education. I was doing that for years, spending countless hours on it, and that definitely affected on RM license.
I always complained that I don't have enough free time to do all improvements I have in mind, but now it's even worse. For about last 1,5 years or more, I manage to find some time for RM almost only when I'm lying sick in bed - like now.

@Joefango, ivill: You asked for help long time ago... did you solve problems yourself or you still need help?
Dubs
Posts: 23
Joined: 19 May 2016, 19:55

Re: Radial menu scripts

09 Jun 2016, 12:30

I personally don't disagree with the terms, I just disagree with the dialog. Realistically it's not going stop anybody from accessing RM's files, it's portable and already on their system. It's redundant, divisive, and there's typos. Your work speaks for itself, but others may not be as forgiving. In my humble opinion, I would rephrase that or remove it altogether.

Don't get me wrong, I have been using RM and love it. My needs are simple, but am having my share of issues. I've been posting my help threads elsewhere because this one has looked somewhat abandoned. If anyone can help, I'd be very grateful:

1) I can't get the media buttons (and search) in the center to work. What code are you supposed to use in order to perform a simple 'Play/Pause' action? Does it need to be linked to an ahk file?
Image
(clockwise from top):
1) Play/Pause {Media_Play_Pause}
2) Next (Media_Next)
3) Search (^f)
4) Stop {Media_Stop}
5) Mute {Media_Mute}
6) Previous {Media_Prev}

Code: Select all

Text=	
Icon=	Play-Pause.png
Action=	{Media_Play_Pause}
Tooltip=	Play/Pause
2) I can't get 32-bit programs to run using the direct exe path (I'm on 64-bit). Radial Menu automatically renames 'Program Files (x86)' to '%A_ProgramFiles%', which doesn't help it run:

C:\Program Files (x86)\Audacity\audacity.exe
%A_ProgramFiles%\Audacity\audacity.exe

I've had to use shortcuts (lnk) to these programs instead. I don't mind this at all, but Is there a trick to running them with '%A_ProgramFiles%'?

3) How do you open a process that already exists, without starting a new one?
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

10 Jun 2016, 00:56

Hi all,

@dubs:
1) According to the good documentation (located in the RM folder) you "can't" use autohotkey command directly in the item action. the correct way to do that is to write a little function in MyFunction.ahk

Code: Select all

Send(What) {
	Send, %What%
	return
}
Then in the item Action you can now call the function and the parameter you want (keystrokes)
ex:

Code: Select all

Action=  fun Send|{Media_Play_Pause}
Action=  fun Send|{Media_Next}
Action=  fun Send|^f
Etc...
Don't know for 2)

3) Take a look at the command Process, IfWinExist, WinActivate. I'm not the best coder but here an example that will work:

Code: Select all

ActivePaint()
	{
	SetTitleMatchMode, 2
	IfWinExist,Paint
	WinActivate,Paint
	}
Return
Once you created this function you can call it via Item Action: Action= fun ActivePaint
Dubs
Posts: 23
Joined: 19 May 2016, 19:55

Re: Radial menu scripts

10 Jun 2016, 20:09

@joefango
Hi Joefango, thanks for responding :]

1) I can't get this to work, I may be doing this completely wrong. I seem to be misinterpreting your first example. What exactly goes inside the parentheses? I used "%" in place of the brackets but neither of them responded. Could you give working examples for Media_Play_Pause and ^f?

Image
Image

3) Does this code also go inside My functions.ahk? Do i have to replace "Paint" with the full path? Could you give a working example for Google Chrome? I learn a lot from examples, I can just replace the code with what is needed.
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

11 Jun 2016, 01:46

your item action is good but the function is bad. you don't need to make one for each... You have to put the exactly same thing that I wrote in MyFunction.ahk:

Code: Select all

Send(What) {
	Send, %What%
	return
}
The "what" in the function is a parameter and it act as a variable. when you call the function you give a parameter, and that parmeter is your keystroke.
"fun Send" is the call, "|" is a separator and right after you put your keystroke

In your item action:

Code: Select all

Action=  fun Send|{Media_Play_Pause} ; <- this is the parameter/variable/keystroke
for ^f

Code: Select all

Action=  fun Send|^f
3)
Put this in MyFunction.ahk :

Code: Select all

ActiveChrome()	; this is the name of the function call it what you want
	{
	SetTitleMatchMode, 2
	IfWinExist, Google Chrome
	WinActivate, Google Chrome
	}
Return
Then in the item action, you need to call that function:

Code: Select all

Action=  fun ActiveChrome
You can also make it universal replacing google chrome by what you want by using a variable in the function:

In MyFunction.ahk:

Code: Select all

ActiveTheWindowIWant(WhichWindow)	; this is the name of the function call it what you want
	{
	SetTitleMatchMode, 2
	IfWinExist, %WhichWindow%
	WinActivate, %WhichWindow%
	}
Return
Then in Item action:

Code: Select all

Action=	fun ActiveTheWindowIWant|Google Chrome

Code: Select all

Action=	fun ActiveTheWindowIWant|Paint

Let me me know if that's ok
User avatar
Learning one
Posts: 173
Joined: 04 Oct 2013, 13:59
Location: Croatia
Contact:

Re: Radial menu scripts

11 Jun 2016, 13:12

@metacognition:
... I just can't promise to check back twice a month to see if you've changed your license ...
Yeah, I definitely agree that's to often :) , but maybe that's why Radial menu scripts topic has more than 338000 views on the old forum. :P Just joking. ;)

@Dubs:
Joefango gave you really good answers. Do as he said.
I can't get 32-bit programs to run using the direct exe path (I'm on 64-bit)
Can you run them by using stand-alone AutoHotkey script (not as part ot Radial menu) like this? :

Code: Select all

Run, C:\Program Files (x86)\Audacity\audacity.exe
I just disagree with the dialog
What do you suggest, which text should be displayed when user presses "No" as answer to "Do you agree on all license and autorship terms?"

One more thing; I see you're using Notepad to edit ahk files.
Use this fantastic code editor: SciTE4AutoHotkey. It's MUCH better to use this editor instead of Notepad and it will definitelly help you to learn and understand AHK coding much faster & easier. It will also make your coding process fun & enjoyable.
lotion
Posts: 3
Joined: 11 Jun 2016, 13:35

Re: Radial menu scripts

11 Jun 2016, 13:39

Hey, I have a question regarding the possiblity to insert specific text parts into a software.
What I wanna do is to click on an item and a specific combination of letters is written/inserted into the active window.
Could sombody explain me how to realise this?
Thank you very much.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble and 109 guests