Radial menu scripts

Post your working scripts, libraries and tools for AHK v1.1 and older
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

11 Jun 2016, 13:46

@lotion: Yes you can as explained in my previous post
lotion
Posts: 3
Joined: 11 Jun 2016, 13:35

Re: Radial menu scripts

11 Jun 2016, 14:28

hey, thanks for your response.
I wanna insert the following text passage: I, Bmf, F2, Cp

I dont understand what write into my functions.ahk after reading your previous post.
something like this: Action= fun Send|{I, Bmf, F2, Cp} ?


*edit
Ok, I have now added

Send(What) {
Send, %What%
return
}

to my functions.ahk. Then I added in the menu designer an item with the Action= fun Send|{I, Bmf, F2, Cp}
Unfortunately this does not seem to work.
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

11 Jun 2016, 15:20

In MyFunction.ahk you need that:

Code: Select all

Send(What) {
	Send, %What%
	return
}
And in the item action

Code: Select all

Action=	fun Send|I,{Space}Bmf,{Space}F2,{Space}Cp
You can find keys reference here: https://autohotkey.com/docs/commands/Send.htm
lotion
Posts: 3
Joined: 11 Jun 2016, 13:35

Re: Radial menu scripts

11 Jun 2016, 15:28

Thank you for the informative link and your correction. It works perfectly now.
Dubs
Posts: 23
Joined: 19 May 2016, 19:55

Re: Radial menu scripts

11 Jun 2016, 21:22

@Joefango
1) Thanks for explaining that, I managed to get the Search button to working (^f), but none of the media buttons are responding (Play/Pause, Next, Previous, Stop or Mute). My media player was open and I had a track playing, but no button would respond. The media keys on the computer hardware are controlling the player just fine, but RM is having no effect. Before RM, I used AHK to control the media keys, so i know it can be done..

Image

Image

Image

3) That worked perfectly! I noticed this only works on programs that are already open, not ones that are closed. Do you know of any code that can open a program if its not already open, and if it is open, open the existing one instead? If you have no idea, that's okay :]

@Learning one
Using Run doesn't work, it does nothing. RM still renames 'Program Files (x86)' to %A_ProgramFiles%' in the path: Run, %A_ProgramFiles%\Audacity\audacity.exe

As for the message suggestion, after hitting 'No' I would just close the program.. no message.

Thanks for the recommendation, I use Notepad++ but have been using Notepad because it's slightly less chaotic to look at
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

12 Jun 2016, 02:33

1) I just tested on vlc and mediaplayer and it works fine here. The window have to be active. is it the case ?

3)
3) How do you open a process that already exists, without starting a new one?
I was a little confused by the request... This is normal you need to tell autohotkey to check if a process or a window already exist. it's a good exercise for you to learn how to do that because it is the basics:

1 - you need to check if a process or a window exist. You have many way to do that by using following commands:

IfWinExist that check if a window exist https://autohotkey.com/docs/commands/WinExist.htm (recommended)
IfWinNotExist the same inverted https://autohotkey.com/docs/commands/WinExist.htm
Process https://autohotkey.com/boards/posting.p ... 78#preview

2) If your process or window exist you have to "WinActivate" it : https://autohotkey.com/docs/commands/WinActivate.htm

3) Else you need to "Run" it: https://autohotkey.com/docs/commands/Run.htm

Try to mess a bit with that and I will perform script corrections ;)
Dubs
Posts: 23
Joined: 19 May 2016, 19:55

Re: Radial menu scripts

12 Jun 2016, 23:27

1) Nevermind I figured this one out. I'm using the Google Play Music Desktop Player: http://www.googleplaymusicdesktopplayer.com/, it works with media keys. I just learned I could set custom hotkey functions inside it, and that's what I did. It works now :]

3) Would this work?

ActiveProcess(Process)
{
SetTitleMatchMode, 2 ; what does this mean?
IfWinExist, %Process%
WinActivate, %Process%
IfWinNotExist, %Process%
Run, %A_WinDir%\system32\mspaint.exe
}
Return

Text=
Icon= Paint.png
Action= fun ActiveProcess|Paint
Tooltip= Paint

I imagine I'm gonna have to set this up for every exe, but I'm not sure how to set up the variable to do this:

ActiveProcess(Process)
{
SetTitleMatchMode, 2
IfWinExist, %Process%
WinActivate, %Process%
IfWinNotExist, %Process%
Run, %A_WinDir%\system32\mspaint.exe
Run, %A_WinDir%\notepad.exe
Run, etc etc...
}
Return
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

13 Jun 2016, 02:22

1) No it works only if the window is active, to send keys on a background running app you need to use an other command named ControlSend: https://autohotkey.com/docs/commands/ControlSend.htm.
You need to learn how we can find or identify windows by looking here: https://autohotkey.com/docs/misc/WinTitle.htm

3) No but you made some progress, here is a script that will work:

Code: Select all

ActivateOrRunChrome()
	{
	SetTitleMatchMode, 2		;Set the matching behavior to find a window. mode 2 means autohotkey will look in all the tittle to find the words specified
	IfWinExist, Google Chrome		; there is always "Google Chrome" words somewhere in the tiitle of the chrome window so I want to look at it
	WinActivate, Google Chrome	; Activate the found window
	Else Run, "C:\your\path\tochrome.exe"
	}
Return
Then in the item action

Code: Select all

Action= fun ActiveOrRunChrome
Of course you can make it "universal" using variables

Code: Select all

ActivateOrRunMyApp(Which,Path)	;note that we are using 2 parameters
	{
	SetTitleMatchMode, 2
	IfWinExist, %Which%
	WinActivate, %Which%
	Else Run, %Path%
	}
Return
The in item action:

Code: Select all

Action=	fun ActivateOrRunMyApp|Google Chrome|"YourPathToChrome.exe"

Code: Select all

Action=	fun ActivateOrRunMyApp|Paint|"YourPathToPaint.exe"
Dubs
Posts: 23
Joined: 19 May 2016, 19:55

Re: Radial menu scripts

13 Jun 2016, 20:29

Yesterday I had edited the post above to mention that the Google Music player i use actually has customizeable hotkeys built-in, so that took care of the media buttons. For anyone interested, the hotkeys can only be set with ctrl:
Image

The examples you wrote for the window processes are perfect, they work great and reviewing them has been very educational to me!

I'm very thankful for your help, you've been patient with me and I really appreciate that :D
User avatar
metacognition
Posts: 117
Joined: 22 Oct 2014, 05:57
Location: Alaska
Contact:

Re: Radial menu scripts

15 Jun 2016, 10:18

@L1:
Thanks for you responses. You are a scholar and a gentleman.
Hope you are feeling better. :D
Best,
Meta.
ilyaorlov

Re: Radial menu scripts

18 Jun 2016, 13:10

Just want to thank you for Radial Menu!

Three days of having fun programming :)) A great tool!
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Radial menu scripts

21 Jun 2016, 13:38

Dear Learning One,

This is awesome. A great piece of software. Thank you very much for sharing it. I'm heavily impressed by the designer and ease of use.
ciao
toralf
DrDave
Posts: 9
Joined: 13 Mar 2016, 11:34

Re: Radial menu scripts

01 Jul 2016, 08:50

Have been playing around with Radial menu and I really love it. Thanks for putting this together and job well done.

I have been trying to understand the "context sensitive" aspect of using this application but cannot find anything to support this.

Can you explain?

Cheers,

David
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

01 Jul 2016, 14:52

hi,
Have you read the nice documentation made by L1 ? basically you can create additional menus and show them according to the application you are using. Say you are working on paint you can have a menu for paint,using notepad you can have a menu for notepad, webrowser,etc...
I use it a lot while working with applications that requires many functions, or if you have repetitive boring tasks to do every time
suija

Re: Radial menu scripts

12 Aug 2016, 12:29

I need to make my right click menu context sensitive, but I don't know what to edit. The best I got is making it a shortcut in My hotkeys.ahk:

Code: Select all

F7::
MouseGetPos,,, hWinUnderMouse	
WinGetClass, WinUnderMouseClass, % "ahk_id " hWinUnderMouse
if WinUnderMouseClass in Photoshop
MenuToShow := 56
else
MenuToShow := 57
RMApp_MyRMHandler2(MenuToShow)
return
I want the same functionality on my normal right click.
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

12 Aug 2016, 14:55

Hello,
Maybe the right click is set for the main menu and you can't override it to show your context sensitive menu ?... In this case try to delete the RMShowHotkey in the general settings and you should have the ability to bind your menus to the right click
suija

Re: Radial menu scripts

13 Aug 2016, 00:04

Making it a right mouse button hotkey in My hotkeys.ahk overwrites the mouse RButton so no right click any more, also I can't make the select method "click" as per the general settings.
Actually now that I look at it, the submenus of my code don't work either.
I just need the default right click-drag-down menu to be context sensitive (with window under mouse method). I am not a coder so... anything helps, especially which file has the code for this thing.
Joefango
Posts: 30
Joined: 05 Mar 2016, 07:36

Re: Radial menu scripts

13 Aug 2016, 16:04

I'm not a good coder also, but from what I know the main menu and additional menus like yours (56,57) are not working the same way. for instance Submenus are not available with additional menus.
If you want to use context sensitive menus(without submenu feature) and with the 'right click drag down', I think you need first to change the RMShowMethod to "U" then you can use the mouse gesture down to show your context sensitive menus
Let me know if you can deal with that
bendy303
Posts: 13
Joined: 05 Dec 2014, 00:33

Re: Radial menu scripts

16 Dec 2016, 18:50

quick question....I know autohotkey can detect which window is or program is focused - is it possibe to have radial menu only work when a certain program is open, such as Cubase?
User avatar
metacognition
Posts: 117
Joined: 22 Oct 2014, 05:57
Location: Alaska
Contact:

Re: Radial menu scripts

16 Dec 2016, 19:17

This would be a good start:
https://autohotkey.com/docs/commands/_IfWinActive.htm

Or this

Code: Select all

Process, Exist, process.exe
if(errorlevel)
{
    ; do stuff here
    
}
The above code would be immediately after a hotkey declaration.

It would check if the "process.exe" is running
You would replace "process.exe" with whatever cubase exe name is... then call your function or subroutine from in brackets.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 74 guests