Radial menu v4(Autohotkey轮盘)

Radial menu v4(Autohotkey轮盘)-AutoAHK

这是一个便捷的轮盘工具,非常好玩、好用。但是需要您有一定的英文能力和自定义能力。

目前只有英文帮助。

Radial menu v4

Radial menu is a new method of giving commands to computers. It’s a powerful hotkey, menu, launcher, mouse gestures system, and much more.

Packed in ergonomic interface, portable, driven by AutoHotkey, highly adjustable and extendible, can do almost anything you wish.

Table of Contents:

Introduction

General settings

General

FileExtensions

SkinOverride

Profiles

Radial menu component

Radial menu designer

Structure and concept

Items – basic

Item attributes in details

Item Action possibilities

General menu attributes

Context-sensitive radial menus

Mouse gestures component

Mouse gestures alpha (MGA)

Navigator

Checking for updates

 

Folders in RM

Skins

Some built-in functions

RMApp_ExecuteSelectedText()

RMApp_Redraw()

RMApp_AutoExecute()

Inter-process communication

Window messages

RM live code

Events

OnAutoExecute

OnExit

OnRMShowHotkey

BeforeExecuteItem

AfterExecuteItem

OnReceiveMessage

Events – tips & tricks

Other info

 

Introduction

Components. Radial menu application consists of following components:

  • radial menu
  • mouse gestures
  • all AutoHotkey features (hotkeys, hotstrings, etc.)
  • some other extra features (Navigator, always on top toggle, etc.)

Default hotkeys:

  • Rbutton (right mouse button):

–          Drag down and hold to show radial menu, release it to select item.

–          Drag in other directions to execute mouse gesturesDrag up shows Navigator.

  • Lbutton (left mouse button): shows/hides submenus

Normal Rbutton’s click function is always preserved – just click, and don’t drag. Lbutton shows/hides submenus only while main menu is shown – in all other cases, it has normal Lbutton function. So Radial menu virtually occupies 0 hotkeys but provides thousands of possible hotkey-like actions via radial menus and mouse gestures.

Abbreviations. RM is abbreviation for Radial menu. RM is abbreviation for folder in which Radial menu is located.

Customization. Structure. RM application can be customized a lot. You can customize all hotkeys, gestures, menus, actions, skins, sounds and a plenty of other things by editing .txt and .ahk files;

  • General settings can be edited in RMMenu definitionsGeneral settings.txt
  • Main menus (or profiles) can be found and edited in RMMenu definitions. For example: Main profile.txtWork profile.txt …
  • Submenus can be found and edited in RMMenu definitionsSubmenus. For example: Comp control.txtFolders.txt …
  • Context-sensitive radial menus can be created and edited in RMMenu definitionsContext-sensitive.
  • Navigators can be found and edited in RMMenu definitionsNavigators. For example: Example navigator.txt
  • My codes folder. In appropriate .ahk files in this folder, you can create and edit your mouse gestures, functions, hotkeys, etc.
  • Radial menu.ahk. Radial menu application is encapsulated, so you can write your code directly in RM’s main code and make your perfect portable master script. Hotkeys, hotstrings, timers, GUI-s, additional menus… anything you need.

Default RM setup is just suggestion how it should it be set up. You have total freedom to change it, and it’s up to you to set it up to fit your needs.

Just to be clear, it will take some time until you explore all possibilities that Radial menu offers.

Radial menu.exe is in fact renamed AutoHotkey Unicode 32-bit (AHK in later text). AHK is created by Chris Mallett and Lexikos, with portions by AutoIt Team and various AHK community members. It is licensed under GNU General public license which is included in “Legal” folder. You can get AHK source code and other relevant information at https://github.com/Lexikos/AutoHotkey_L, www.autohotkey.com, ahkscript.org and in “Legal” folder. What I (RM author) am protecting as my work is a set of instructions for AHK contained in ahk, txt and other files; Radial menu is one big, complex AutoHotkey script which is licensed under Radial menu license. Understand that when you run Radial menu.exe and Radial menu.ahk exists in the same folder, you are using Radial menu program and Radial menu license applies.

 To upgrade to latest version of AutoHotkey; exit RM, delete Radial menu.exedownload latest AutoHotkey, rename it to Radial menu.exe, and put it in RM folder. Note: ANSI build is not allowed, only UNICODE.

General settings

Open RMMenu definitionsGeneral settings.txt. There are 3 sections in it: GeneralFileExtensions and SkinOverride.

General

RMSelectMethod. Determines how do you select items and how long is main menu displayed. Can be: 1) release 2) click.  It’s set to release by default.

  1. Release. Release to select method. In this method, main menu is displayed while your RMShowHotkey (Rbutton by default) is down. Releasing it selects (or not) item and hides menu(s). This method is appropriate for not-touchscreens and is generally recommended.
  2. Click. Click to select method. In this method, main menu is displayed until you click with RSMShowHotkey (Lbutton by default) which selects (or not) item. In this method, RSMShowHotkey should be set to Lbutton and it’s appropriate for touchscreens.

Examples:

RMSelectMethod = release

RMSelectMethod = click

RMShowHotkey. Button that shows RM’s main menu or executes mouse gestures. It’s Rbutton by default. It can be: 1) any mouse button that can be pressed down and 2) any keyboard key except alt, control, shift, win (modifiers). Hotkey combinations are not allowed. Examples:

RMShowHotkey = Mbutton

RMShowHotkey = Xbutton1

RMShowHotkey = a

RMShowHotkey = 2

RMShowHotkey = F5

RMShowMethod. Method which shows RM’s main menu. Can be 1) Mouse gesture or 2) Show delay.

  1. Mouse gesture(recommended in release to select method). If RMShowMethod is set toU or or R or L, then method which shows RM’s main menu is a mouse gesture. U means up, D down, R right, L left. It’s set to D (down) by default. Examples:

RMShowMethod = U

RMShowMethod = D

RMShowMethod = R

RMShowMethod = L

For example, RMShowMethod = D will show RM’s main menu when you do down movement with your mouse.

Although combination of moves in one gesture is not allowed here (for example: RMShowMethod = UD – “up, down” movement), you can have multiple single directions set as a RMShowMethod; write them down as a comma delimited list. Examples:

RMShowMethod = U,D

RMShowMethod = L,R

For example, RMShowMethod = L,R will show RM’s main menu when you do left or right movement.

Minimal mouse movement distance which RM recognizes as a gesture is 9 pixels. If you want to send normal Rbutton click, just click and don’t drag. If RMShowMethod is blankD applies.

  1. Show delay. If RMShowMethod is anumber, then method that shows RM’s main menu is a show delay. Show delay is amount of time in miliseconds for which you must hold RMShowHotkey before RM’s main menu shows up. For example;0 means instant show, no delay, and 220 means show after 220 miliseconds.  If you want to send normal Rbutton click, press and release it within specified number of miliseconds. If you will hold it for a time longer than specified, than RM’s main menu will show. In this method, mouse gestures are disabled. For your security, specifying RMShowHotkey = LButton and RMShowMethod lesser than 220 is not allowed. In this situation, RMShowMethod will automatically be set to 220. Examples:

RMShowMethod = 0

RMShowMethod = 220

RMShowMethod = 300

RSMShowHotkey.

  • if release to select method applies, this is a button that shows/hides submenus.
  • if click to select method applies, this is a button that selects (or not) item.

It’s set to Lbutton by default. It can be any other mouse button or any keyboard key. Hotkey combinations are not allowed. Note that this is context sensitive hotkey. It has RM specific function only when RM’s main menu is shown. In all other cases, it has normal function. RMShowHotkey and RSMShowHotkey can not have the same hotkey. Examples:

RSMShowHotkey = Rbutton

RSMShowHotkey = Xbutton2

RSMShowHotkey = s

RSMShowHotkey = 4

RSMShowHotkey = F9

Combination examples for release to select method.

When RMShowMethod is mouse gesture When RMShowMethod is show delay
RMSelectMethod = release

RMShowHotkey = Rbutton

RMShowMethod = D

RSMShowHotkey = Lbutton

RMSelectMethod = release

RMShowHotkey = MButton

RMShowMethod = U

RSMShowHotkey = RButton

RMSelectMethod = release

RMShowHotkey = Rbutton

RMShowMethod = 220

RSMShowHotkey = Lbutton

RMSelectMethod = release

RMShowHotkey = Xbutton1

RMShowMethod = 0

RSMShowHotkey = Lbutton

Combination example for click to select method – for touchscreens.

RMSelectMethod = click

RMShowHotkey = F5

RMShowMethod = 0

RSMShowHotkey = Lbutton

P.S. maybe you’ll prefer MainMenuShowPos = center here

Sounds. 1 means on, 0 or blank means off.

MainMenuShowPos. Main menu show position. Can be:

  1. under mouse or blank          shows main menu under mouse
  2. center                                          shows main menu on the center of the screen
  3. x,y                                                 shows main menu centred at x,y coordinates relative to screen

RMProcessPriority. RM’s process priority.  Can be set to Normal, AboveNormal, and High. Any other setting is ignored, and RMProcessPriority is automatically set to AboveNormal, which is also default setting.

ExploreKey. If this key is down while you select item, RM will try to explore item’s action path in Windows explorer instead of launching it. It should be a modifier – alt or control or shift. It’s control by default. To disable this, just leave it blank.

TrayDoubleClick. Here specify which RM tray menu item will be launched when you double click on RM’s tray icon. It’s set to Suspend by default. Can be: Open RM folder, Radial menu designer, Skin and profile changer, About, Suspend, Reload, Exit. To disable this, just leave it blank.

CreateShortcut. 1 means create shortcut to Radial menu.exe in RM folder, 0 or blank means don’t. However, if RM is not run from fixed drive, shortcut will not be created. To run RM automatically whenever your turn on your computer, put a RM shortcut in a Startup folder.

ShowTooltips. 1 means on, 0 or blank means off.

RunSoundPlayers.  1 means on, 0 or blank means off. If set to off, RM will not run 4 assistant scripts responsible for playing sounds. In that case, RM will consume less RAM, but you will hear no sounds (no matter if Sounds = 1), and all “sounds on methods” will not have effect.

CenterMouseOnSubmenuOpen. 1 means on, 0 or blank means off.

AutoCheckForUpdates. Here you can enable/disable auto check for updates feature, and specify which updates will be checked. Examples:

Example Description
AutoCheckForUpdates = 0 do not auto check for updates (disable)
AutoCheckForUpdates = RM AHK auto check for both RM and AutoHotkey updates
AutoCheckForUpdates = RM auto check only for RM updates
AutoCheckForUpdates = AHK auto check only for AutoHotkey updates

Default: AutoCheckForUpdates = RM AHK. RM can check for updates only when you are connected to internet. If you are offline in a moment when RM automatically checks for updates, nothing will happen (you won’t get “error” or “please connect to internet” messages), and RM will check your internet connection status again later. Once you are notified that updates are available, RM will stop auto checking for updates.

Please read Checking for updates. When you manually check for updates by selecting Check for updates item from Menu control submenu, it will always check for both RM and AutoHotkey updates, and will automatically turn off auto check for updates feature.

FileExtensions

Designed for portability. Here you can specify that if item action has certain extension, when you select it, RM will unconditionally launch it with specified application. This is handy if you are using RM from a USB stick on computer that hasn’t got your favorite applications installed. RM string is automatically replaced with directory in which RM is located. It’s equal to %A_ScriptDir%. You can also use variables and double-dots in paths, and .extension here, like in Item Action (later about that).

For example, ahk = RMRadial menu.exe means: no matter is AutoHotkey installed on current computer, if item action has .ahk extension, launch it with RMRadial menu.exe. So you can launch your scripts via RM anywhere and you don’t have to compile them. Remember that Radial menu.exe is in fact renamed AutoHotkey Unicode 32-bit.

You can put RM and your favorite portable applications on USB stick, associate file extensions to appropriate executables,  and you can feel like home on any computer. You can associate as many extensions as you wish – there is no limit.

Use double-dots in paths to refer to a folder above RM folder. For example, if you have folder structure like this on your USB stick;

H:Portable AppsRadial menu v4

H:Portable AppsInkscape

you can specify svg = ..InkscapeInkscapePortable.exe to launch items which have .svg files as ItemAction with portable version of Inkscape.

Example FileExtensions section in General settings.txt:

[FileExtensions]

ahk = RMRadial menu.exe

svg = ..InkscapeInkscapePortable.exe

SkinOverride

Here you can override any Skin attribute and ItemLayoutPerRing. I recommend that you don’t use this possibility for changing skin attributes because it’s better to edit skin directly in its definition; Skin definition.txt. Example:

[SkinOverride]

AutoSubmenuMarking = 0

RadiusSizeFactor = 1.1

ItemLayoutPerRing = 8.14.20

AutoSubmenuMarking. 1 means on, 0 or blank means off. If AutoSubmenuMarking is turned on, than every item which has submenu will be marked with two tiny stars near the top of the item.

RadiusSizeFactor . With RadiusSizeFactor you can “compress” or “decompress” menu; decrease or increase menu’s size. For example, 0.8 will decrease and 1.2 will increase menu size.

Other skin attributes. For a list of other skin attributes like TextSizeIconTrans, AutoSubmenuMark, etc., see Skin definition.txt files. Read about Skin attributes.

Profiles

There may be a situation when you will want to load different main menu and submenus. That’s why profiles are created. You can have profile for home, for work, for being portable, for this, for that, etc. Every profile loads different main menu and can have different submenus. However, submenus can be shared – for example Comp control, Menu control etc. Every file located in  RMMenu definitions with .txt extension except General settings.txt is considered as profile. You can change your current profile by selecting Skin & profile changer item in Menu control submenu. It’s good to know that you can create profile sensitive mouse gestures, hotkeys, hotstrings, etc.

Radial menu component

Radial menu designer

Radial menu designer (RMD) is a toll that helps you to easily create and edit radial menus (and some other files too). To launch RMD, select Menu control submenu and then Radial menu designer item. Watch this quick tutorial video to learn how to use it. Note that watching the video and playing with RMD is not enough to fully understand RM’s radial menu component, so please read on.

Structure and concept

Open RMMenu definitionsMain profile.txt. That is the place where Main profile’s main menu is defined. Submenus are located in RMMenu definitionsSubmenus

There are two basic sections in every menu definition:

  • Section where you define items and their attributes: for example: [Item1], [Item2], [Item3] etc. and
  • Section where you can define some general menu attributes marked with [General]. This is optional section.

There is one additional optional section in main menus – [Navigator].

Items – basic

Item attributes. There are 7 possible item attributes: TextIconActionTooltipSubmenuSpecItemBack and SpecItemFore. You don’t have to use them all. In more than 90% cases, you’ll use just 3 basic item attributes – texticonaction. Other attributes are not so frequently used.

 

First task – change Item8 text and action.

  1. Find [Item8]in RMMenu definitionMain profile.txt
  2. Replace this text:

[Item8]

Text=       item

with this:

[Item8]

Text=       C disc

Action=     C:

  1. save changes inMain profile.txt
  2. Reload RM (or run it if it isn’t already running)

Now you have just edited Item8 in main menu. It now has text C disc and when you select it, it will open C:. This is the most basic example how you can edit items and its attributes. On this principle, you can edit any item in any menu. Study other menus and submenus and you’ll get it. Always when you want changes to take effect, you must: 1) save changes in .txt (or .ahk) file and 2) reload RM

Existence of item. Item must have Text or Icon to exist in menu. All other attributes are optional.

Icons. All icons must be in .png format and located inside RMIcons folder (sub-folders are allowed).

Separators. If you want to put a separator between items, simply omit it, or leave its text or icon blank. Example in which Item2 is separator:

[Item1]

Text=       Item

[Item3]

Text=       item after separator

Other item attributes. If you need more than just 3 basic item attributes (texticonaction), write them down.

Here is a not functional example that shows item that has all possible attributes defined:

[Item6]

Text=             Hello

Icon=             Files.png

Action=           C:MyDocument.doc

Tooltip=          I’m complicated item

Submenu=          Files

SpecItemBack=     nb

SpecItemFore=     C:Special foreground.png

Item attributes in details

There are two forbidden characters that you can’t use in any item attribute except Action: | and >. If RM finds them, it will automatically replace them with space.

 

Text. Can be anything (except two forbidden characters). Do not use long text or long single words. Use abbreviations, for example apps instead of applicationsTooltip is a right place where you can write long text if you need it.

Icon. All icons must be located inside RMIcons folder and must be in .png format. Do not use .ico format. Icons can be specified without .png extension, so for example, both of these are valid: Icon = Notepad.png and Icon = Notepad.  If you want, item can have text and icon at the same time. You can use icons from sub-folders inside Icons folder, so for example, this is valid: Icon = SomeSubfolderNotepad.png.

Action. Later about that.

Tooltip. If blank, tooltip is automated – it is equal to item’s text or icon name without extension. If it isn’t blank, specified tooltip applies. You can use multi-line tooltip by specifying `n. Example: Tooltip = Hello!`nI’m multi-line tooltip. If you don’t want tooltip for some item, specify ntt which means no tooltip. Example: Tooltip = ntt. But remember, to generally turn all tooltips off, open RMMenu definitionsGeneral settings.txt and in General section specify ShowTooltips = 0.

Submenu. Here you can specify name of item’s submenu. Submenu must exist in RMMenu definitionsSubmenus. For example, if item has Submenu = Files, that means that RM will open Files.txt submenu located in RMMenu definitionsSubmenus when you select that item. There is not built-in support for sub-submenus or deeper. However, this can be done via custom functions and My radial menus (later about that), but I don’t recommend it. After a lot of testing, I simply found sub-submenus or deeper not practical and useful enough to build them in.

SpecItemBack. Special item background. Can be: 1) blank – than normal item background from skin applies, 2) full path of special item background, 3) nb which means no background. You can use RM string and variables in paths here, like in Item Action.

SpecItemFore. Special item foreground. Can be: 1) blank – than normal item foreground from skin applies, 2) full path of special item foreground, 3) nf which means no foreground. You can use RM string and variables in paths here, like in Item Action.

SpecItemBack and SpecItemFore are useful if you want to visually mark some item, make it visually different from others.

Item Action possibilities

Variables in paths. Item action supports AutoHotkey built-in variables like %A_WinDir%, %A_ProgramFiles%, %A_Desktop% etc. Example: Action = %A_WinDir%notepad.exe

RM. String RM is automatically replaced with folder in which RM is located. It’s equal to %A_ScriptDir%. Example: Action = RMUtilitiesScript.ahk

Double-dots in paths (..). Double-dots are used to denote the folder above RM folder. So, .. means 1 folder up, …. means 2 folders up, etc.

For example, if RM folder is C:Portable AppsRadial menu v4, than

.. refers to C: Portable Apps

…. refers to C:

….File.txt refers to C:File.txt

..CCleanerCCleaner.exe refers to C: Portable AppsCCleanerCCleaner.exe

….AHK scriptsScript.ahk refers to C:AHK scriptsScript.ahk

Ordinary run command. If item action does not begin with fun, sub, single-dot (.), RWRM, and it’s not integer, it is considered as AutoHotkey’s Run command first parameter – target. However, RM refines item action, so launching should be more flexible. If you want to pass parameters, add them immediately after the program or document full path and enclose them in double quotes. In case that you can’t run something, create and use custom function. Here are some item action examples that are being executed with ordinary run command:

Action = C:

Action = C:MyDocument.doc

Action = explore C:

Action = C:Script.ahk

Action = %A_ProgramFiles%CCleanerCCleaner.exe “/auto”

Action = %A_ProgramFiles%GoogleChromeApplicationchrome.exe “-incognito”

Action = %A_WinDir%explorer.exe

Action = edit RMMy codesMy functions.ahk

Action = explore %A_ScriptDir%

Action = RMInternalCodesHibernate.ahk

Action = ::{645ff040-5081-101b-9f08-00aa002f954e}

Action = explore ::{645ff040-5081-101b-9f08-00aa002f954e}

Action = inetcpl.cpl

Action = ..File.txt

Action = ….

Action = ..InkscapeInkscapePortable.exe

Action = notepad “RMInternalCodesHibernate.ahk”

Action = %A_ProgramFiles%Windows Media Playerwmplayer.exe “C:Song1.mp3” “C:Song2.mp3” “C:Song3.mp3” “C:Song4.mp3”

Executing functions. If item action begins with fun, RM will execute appropriate function. For example, if Action = fun Demo1, that item will execute Demo1 function, or if Action = fun RMApp_AboutRM, item will execute RMApp_AboutRM function.

Functions can be defined in:

  • RMMy codesMy functions.ahk or
  • RM’s main code (Radial menu.ahk) or
  • any other included file (and you can freely include as many function libraries as you want in RM)

So, to execute custom function when you select RM item you must:

  1. specify name of that function (+ fun prefix) as item’s action. Example: Action = fun Demo1
  2. create that function in My functions.ahk, or Radial menu.ahk or any other included file.

Custom functions are useful when you want to execute a few lines of code instead of executing Run command, and you don’t want to create stand-alone script or mouse gesture to do that. With custom functions, you can do  almost anything you wish. You can also include large function libraries in RM, and execute any function by selecting RM item. If function does not exist, nothing will be executed.

You can pass parameters to functions.

For example, Action = fun Demo2|param1|param2|param3 calls: Demo2(“param1”, “param2”, “param3”).

Vertical line character; | is the default delimiter (can be changed) between function to call and its parameters.

Another example; Action = fun Demo2|%A_WinDir%|||4 calls: Demo2(A_WinDir, “”, “”, 4).

Executing subroutines. If item action begins with sub, RM will execute appropriate subroutine (Gosub command). For example, if Action = sub DemoSub, that item will jump to DemoSub label and continue execution until Return is encountered. Analog rules as for executing functions apply.

.extension. If item action begins with dot; . RM will search through windows registry and find what application is associated with that extension, and will launch it when you select that item. Useful for RM portability. For example; Action = .doc should run MS Word on any computer (of course, if it exists, and if .doc is associated with MS Word). Action = .mp3 should open music player, etc.

Special folders. If item action is integer, it is considered as one of ShellSpecialFolders. Examples:

Action = 17 will explore My Computer
Action = 10 will explore Recycle Bin
Action = 3 will open Control Panel

RWRM. Run with Radial menu. If item action begins with RWRM, than RM will run specified file with Radial menu.exe unconditionally, no matter is AutoHotkey installed, and no matter is .ahk extension associated with Radial menu.exe in RMMenu definitionsGeneral settings, in [FileExtensions] section. Useful for RM portability and some RM internal things.

For example; Action = RWRM RMInternalCodesRMD.ahk will unconditionally run RMD.ahk with Radial menu.exe.

General menu attributes

They are rarely used. After mark [General], you can use one or more of these;

SpecMenuBack. Can be: 1) blank – than normal menu background from skin applies, 2) full path of special menu background, 3) nb which means no background. You can use RM string and variables in paths here, like in Item Action.

SpecMenuFore. Can be: 1) blank – than normal menu foreground from skin applies, 2) full path of special menu foreground, 3) nf which means no foreground. You can use RM string and variables in paths here, like in Item Action.

OneRingerAtt. One-ringer attribute. If blank, menu is multi-ringer, if anything else, it’s one-ringer. One-ringer’s radius is automatic – it depends of number of items (and some other things) unless it is fixed. Examples:

OneRingerAtt =                                                           menu is multi-ringer

OneRingerAtt = 1                                                        menu is one-ringer with automatic radius

OneRingerAtt = FixedRadius.100                          menu is one-ringer with radius fixed at 100 pixels

CentralText. It’s set to RM4 by default. You can write what you want here.

CentralImage. You can put some small picture here; logo, dear person, etc. You can use RM string and variables in paths here, like in Item Action.

CentralImageSizeFactor. Formula that applies in menu drawing engine: CentralImageSize := ItemSize*CentralImageSizeFactor.

CentralTextCentralImage and CentralImageSizeFactor do not apply on submenus – they are automatically set depending on item in main menu that opens submenu. They can be specified, but will be ignored.

Example (not recommended, just demonstration):

[General]

SpecMenuBack = nb

OneRingerAtt = 1

Context-sensitive radial menus

Main menus (profiles) and its submenus are static – they do not change depending on active application or some other criteria. But RM offers dynamic, context-sensitive radial menus too. They can be created and used on a few ways – here’s one of them. In this example we’ll make 3 menus;

  1. menu for Paint,
  2. menu for Notepad,
  3. menu for all other cases – General menu,

and assign them to F3 hotkey which will show appropriate menu depending on active window.

Note that this example doesn’t do something useful, it’s just “how to” example – it shows the concept. It’s up to you to create your menus and useful item actions that fit your needs.

Step 1. Create menus

1.1. Let’s create demo menu for Paint;  paste text below in Notepad and save it as “Paint.txt” in “RMMenu definitionsContext-sensitive” folder.

[Item1]

Text=       Action1

Action=     fun Demo2|Paint Action1

[Item2]

Text=       Action2

Action=     fun Demo2|Paint Action2

[Item3]

Icon=       Paint.png

Action=     %A_WinDir%system32mspaint.exe

[General]

OneRingerAtt=     1

CentralText=      Paint

1.2. Let’s create demo menu for Notepad; paste text below in Notepad and save it as “Notepad.txt” in “RMMenu definitionsContext-sensitive” folder.

[Item1]

Text=       Action1

Action=     fun Demo2|Notepad Action1

[Item2]

Text=       Action2

Action=     fun Demo2|Notepad Action2

[Item3]

Icon=       Notepad.png

Action=     %A_WinDir%notepad.exe

[General]

OneRingerAtt=     1

CentralText=      Notepad

1.3. Instead of creating another demo menu – General menu, we’ll use menu that already exists: RMMenu definitionsSubmenusApplications.txt

 

Step 2. Load menus

Open RMMy codesMy radial menus.ahk. Here you can create new or load existing additional radial menus. Put this code inside and save it;

RMApp_LoadMenu(56, RM “Menu definitionsContext-sensitivePaint.txt”)        ; loads menu for Paint, uses Gui number 56

RMApp_LoadMenu(57, RM “Menu definitionsContext-sensitiveNotepad.txt”)      ; loads menu for Notepad, uses Gui number 57

RMApp_LoadMenu(58, RM “Menu definitionsSubmenusApplications.txt”)          ; loads General menu, uses Gui number 58

RM will now know that it has to load 3 additional radial menus we just specified. As you may notice, context-sensitive menus don’t strictly have to be in Context-sensitive folder, but for clarity and good organisation reasons, it’s recommended to put them there.

Step 3. Assign menus to hotkey

Open RMMy codesMy hotkeys.ahk. Put this code inside and save it;

F3::

IfWinActive, ahk_class MSPaintApp   ; if Paint is active window …

MenuToShow := 56                    ; … we will show menu for Paint (Gui number 56)

else IfWinActive, ahk_class Notepad ; if Notepad is active window …

MenuToShow := 57                    ; … we will show menu for Notepad (Gui number 57)

else                                ; in all other cases …

MenuToShow := 58                    ; … we will show General menu (Gui number 58)

RMApp_MyRMHandler2(MenuToShow)      ; Shows appropriate menu, gets selected item and executes item action if something was selected

return

Now we assigned additional radial menus to F3 hotkey and told RM to show appropriate menu depending on active window.

That’s it – reload RM and try it. Be aware that in this example,

  • context-sensitivity depends on active window, but it can depend on anything; current time, window/control under mouse, pixel color, random, some variable in code, etc.
  • we are calling menu via hotkey, but we can call it on other ways too; via mouse gesture, via hovering over some area or clicking on something, etc.

Tip: If you have XButton1 on your mouse, it may be the perfect hotkey for calling context-sensitive radial menus. Note that item’s submenus can be specified, but will be ignored.

Mouse gestures component

RM’s mouse gestures are defined in RMMy codesMy mouse gestures.ahk. When RMShowMethod is a number (show delay), mouse gestures are disabled.

 

Step 1. Introduction

Mouse gestures are specific mouse movements which RM recognizes as a specific command.

RM’s mouse gestures recognition system recognizes 4 basic mouse movements; updownrightleft. Abbreviations for those movements are U (up), D (down) , R (right), and L (left). Minimal mouse movement distance which RM recognizes as a gesture is 9 pixels.

Step 2. Syntax

Open RMMy codesMy mouse gestures.ahk. You will see the following function:

MG_R() {    ; example

MsgBox, 64, RM – mouse gesture example, Hello! I’m mouse gesture %A_ThisFunc%.`nYou can edit me in RMMy codesMy mouse gestures.ahk

}

Lets analyse that. MG means mouse gesture, and R means right. That is the function which RM will execute when you perform drag right mouse gesture.

So, when you:

1) press&hold Rbutton,

2) drag (move) your mouse right for at least 9 pixels, and than

3) release Rbutton,

RM will display message box. Try it.

Step 3. Combinations, limit, cancelling gesture

Combinations. RM can also recognize combination of movements in one gesture, for example;

MG_UR() which means 2 moves gesture: upright or

MG_RLR() which means 3 moves gesture: rightleftright

So, for example, the following function will close active window when you perform drag right, down gesture.

MG_RD() {

ActiveWinID := RMApp_Reg(“ActiveWinID”)

WinClose, ahk_id %ActiveWinID%

}

Limit – 3 moves. Although RM can recognize unlimited number of movements in gesture, for practical and security reasons, number of movements is limited to 3 max. So for example, 4 movement gesture; MG_RDLU() (right, down, left, up) is not allowed. If you perform (draw) such gesture, RM will display message on the screen: Gesture cancelled., and that gesture will not execute nothing, although its function MG_RDLU() may exsist in My mouse gestures.ahk. That 3 moves limit rule allows you to do Cancelling gesture trick.

 

Cancelling gesture – draw circle. If you realize that you made mistake while performing (drawing) gesture, and you want to cancel it, simply draw a circle and than release Rbutton. Drawing a circle will cause that RM will register 4 movements; right, down, left, up or the upside down if your movement was counter clock-wise. As 4 movements are not allowed, gesture will be cancelled. So keep in mind; draw circle = cancel gesture. Not full circle (360 degrees) is required. 271 deegres is always enough, and in some cases even lesser. Try it.

Step 4. Gesture which shows RM’s main menu – No combinations, Occupied direction.

When RMShowMethod is mouse gesture, two important rules apply:

  1. One movement, no combinations. Gesture which shows RM’s main menu can be only one single movement; U or D or R or L, or a comma delimited list of single movements, for example: U,D. Gesture combinations are not allowed – for example, UD (gesture up, down) is not allowed.
  2. Occupied direction(s). When you set direction(s) as movement(s) which show RM’s main menu, all mouse gestures (defined in My mouse gestures.ahk)  which start with that direction(s) will be ignored (will not be executed). For example if RMShowMethod = D, all mouse gestures which start with D letter (down direction) will be ignored; MG_D(), MG_DR(), MG_DL(), MG_DU(), MG_DRU(), MG_DRL() etc. Or if you set RMShowMethod = D,U, all mouse gestures which start with D or U letter will be ignored.

Step 5. Final words

Build your own system. I have decided not to set pre-defined, built-in gestures. Everyone has his own specific needs, so it’s up to you to build your own gestures system that fits you perfectly. My mouse gestures.ahk is tabula rasa, and it’s up to you to write your commands in it. Take a look at some tips in My mouse gestures.ahk.

Perform horizontal and vertical movements. For example, MG_UR() means two movements: up, right not one movement at 45 degrees! If you perform one movement at 45 degrees, RM will not be sure is this right or up movement. Remember the words from Introduction: “RM’s mouse gestures recognition system recognizes 4 basic mouse movements; updownrightleft.” So try to perform strict horizontal and vertical movements! Of course, RM tolerates imperfection. For example, perfect right movement would be drag at 90 degrees, but RM will also register your movement as right if your movement was between 46 and 134 degrees.

Don’t want to use gestures? If you don’t like mouse gestures, and you don’t want to use them, simply delete all functions in My mouse gestures.ahk. When gesture definitions (functions) don’t exist, there is nothing to execute. Also remember that when RMShowMethod is a number (show delay), mouse gestures are automatically disabled, and in that case, you don’t need to delete functions.

Mouse gestures alpha (MGA)

First of all, using regular Mouse gestures should be principle, and using Mouse gestures alpha should be exception. Mouse gestures alpha are developed for only one reason – to enable using release to select method in additional radial menus called via gestures.  If you don’t need that, forget about Mouse gestures alpha and use regular Mouse gestures.  Term “additional radial menus” means radial menus that are loaded via RMApp_LoadMenu() or RM2_CreateMenu() functions in RMMy codesMy radial menus.ahk. You’ll find more info about them in My radial menus.ahk comments.

 

What exactly are Mouse gestures alpha? RM’s mouse gestures recognition system works like this; when you press RMShowHotkey (RButton by default), RM starts to record your mouse movements. For example, if you moved your mouse to the left, it records L, or if you moved it to the left, and then right, it records LR.

The difference between regular Mouse gestures and Mouse gestures alpha is in the moment when they are triggered (executed).

  • Mouse gestures are triggered after user releases RMShowHotkey, if appropriate MG_ function exists.
  • Mouse gestures alpha are triggered immediately when RM detects “hot movement”, while user is doing gesture, without waiting him to release RMShowHotkey, if appropriate MGA_ function exists.

Let’s say user is doing a gesture, and he currently did LR (left-right) movement, but he did not release RMShowHotkey yet. Now, if MGA_LR() function exists, RM considers LR as a “hot movement” and executes MGA_LR() function before user releases RMShowHotkey, and ends RMShowHotkey subroutine. If MGA_LR()  doesn’t exist, than RM normally continues to record user’s movements until he releases RMShowHotkey. Now, let’s say user released it, and that recorded gesture is LR. Then, RM will execute MG_LR() function if it exists, and if it doesn’t, nothing will be executed.

Mouse gestures alpha;

  • can’t be cancelled, because they are executed immediately when “hot movement” is detected
  • they block: 1) all deeper mouse gestures alpha and 2) all deeper or equally deep regular mouse gestures. For example, MGA_LU() blocks:
  1. MGA_LUR(), MGA_LUD(), MGA_LUL(), and
  2. MG_LU() , MG_LUR(), MG_LUD(), MG_LUL()

When and how should I use Mouse gestures alpha? Use them in a situation when you want to call additional radial menu(s) via gestures and you want to use release to select method. That’s the only reason why they exist. For example, let’s say you loaded 3 additional menus in RMMy codesMy radial menus.ahk;

RMApp_LoadMenu(60, RM “Menu definitionsSubmenusMenuA.txt”)     ; loads MenuA, uses Gui number 60

RMApp_LoadMenu(61, RM “Menu definitionsSubmenusMenuB.txt”)     ; loads MenuB, uses Gui number 61

RMApp_LoadMenu(62, RM “Menu definitionsSubmenusMenuC.txt”)     ; loads MenuC, uses Gui number 62

and you want to call them by gestures “left up”, “left right” and “left down” and use release to select method. To do that, put the following code in  RMMy codesMy mouse gestures.ahk;

MGA_LU() {                          ; mouse gesture alpha “left up”

RMApp_MyRMHandler2(60, “r”)   ; shows menu 60, gets selected item and executes item action if something was selected

}

MGA_LR() {                          ; mouse gesture alpha “left right”

RMApp_MyRMHandler2(61, “r”)   ; shows menu 61, gets selected item and executes item action if something was selected

}

 

MGA_LD() {                          ; mouse gesture alpha “left down”

RMApp_MyRMHandler2(62, “r”)   ; shows menu 62, gets selected item and executes item action if something was selected

}

; by the way, “r” parameter means “use release to select method”, and “c” would mean “use click to select method”. If omitted, “r” applies.

That’s it. So for example, you could call your main radial menu (profile) with dragging your mouse down, and with movements left-up, left-right and left-down  you could call additional radial menus, or make any other combination that fits your needs.  Note that those additional radial menus can’t open their own submenus. Of course, you can use context-sensitivity here if you want, as described in Context-sensitive radial menus heading.

Navigator

Step 1. Introduction

Navigator is a drop down menu which helps you to easily navigate to folders that you often use. It navigates to your favorite folders in Windows explorerMy Computer, and in other standard Open, Save, Export, Import, Upload, Select dialog windows.

Navigators are located in RMMenu definitionsNavigators. For example, if you specify;

[Navigator]

Name = Example navigator

in RMMenu definitionsMain profile.txt, that will assign Example navigator to Main profile. Every profile can have its own navigator, or  you can have just one, shared navigator, or you can have no navigator.

Step 2. Defining navigator

Open RMMenu definitionsNavigatorsExample navigator.txt. This is a place where Example navigator is defined –  navigator’s definition.

Each line in navigator’s definition creates one item in Navigator (menu).  Hierarchy is defined by using indentation, more precisely; tab character. Line without tabs on the left creates item in navigator’s main menu. One tab on the left creates subitem, two tabs sub-sub item, and so on. To create separator, specify at least 3 minuses — (but follow indentation).

Equal sign = in each line is a separator between: Item name = Item action = Item icon. Example:

                AHK scripts = C:AHK scripts = AHK.ico

Navigator’s item action can be:

Type Example
folder path C:My folder
drive letter C:
ShellSpecialFolderConstant 17
network path (UNC) \my.server.com@SSLDavWWWRootFolder
function fun MyFunction
subroutine sub MySubroutine

Navigator’s item action can’t refer to a file, because navigator’s purpose is to navigate, not to launch something. Item action supports AutoHotkey built-in variables (%A_WinDir% etc.), double-dots in paths (..),  and RM string is replaced with folder in which RM is located. Item icon in Navigator is very rarely used.

Example Navigator:

My Documents

My Documents = %A_MyDocuments%

My Pictures = C:Users%A_UserName%Pictures

My Music = C:Users%A_UserName%Music

My Videos = C:Users%A_UserName%Videos

 

System

Program files = %A_ProgramFiles%

Windows = %A_WinDir%

—————

Temp = %A_Temp%

App data = %A_AppData%

 

Special folders

My Computer = 17

Recycle Bin = 10

Control Panel = 3

 

Misc

AHK scripts = C:AHK scripts

Games = C:Games

Jonny = C:Jonny

 

RM = RM

Note that you can’t always navigate to all ShellSpecialFolders. For example, you can’t navigate to Control panel while you’re in standard Open File dialog box window, but you can always navigate there while you’re in Windows explorer.

Step 3. Calling navigator

By default, you call Navigator to show by drag up mouse gesture. You can change that, and assign it to some other mouse gesture, or some other hotkey. There is no “setting” in General settings.txt where you can define how do you call Navigator – that’s defined via files in RMMy codes folder (later about that). Function that you have to call to show Navigator is RMApp_Navigator().  For example,  F1::RMApp_Navigator() in RMMy codesMy hotkeys.ahk will show navigator when you press F1 key.

Step 4. Final words

Build your own Navigator. Default Navigator is just example to help you to understand how you can create your own. It’s  is tabula rasa, and it’s up to you to write shortcuts to your favorite folders in it.

Don’t want to use Navigator? If you don’t like Navigator, simply don’t assign it to profile. For example, if you don’t want use Navigator in Main profile, in RMMenu definitionsMain profile.txt specify

[Navigator]

Name =

or simply completely delete navigator section.

Advanced. If Navigator doesn’t work as expected in some dialog windows, you can adapt the method how it interacts with window controls in RMApp_NavControlHandler() function located in RMInternalCodesNavigator – control handler.ahk.

Checking for updates

Updates can be checked:

  • automatically  – see AutoCheckForUpdates (turned on by default)
  • manually – by selecting Check for updates item from Menu control submenu

RM can check for updates only when you are connected to internet. If RM can’t read last version number from the internet (for example if server is down or timeout occurred) instead of version number, you’ll see a word unknown.

When RM is checking for updates, it will temporarily disable (suspend) all hotkeys and hotstrings registered in RM process, and that will last for about 2 seconds.  So if it happens that you call RM and it refuses to show, that probably means you called RM just in a moment when it is checking for updates – don’t panic, just wait for about 2 seconds and then call RM again.

[simple explanation] When RM checks for:

  • AutoHotkey updates, it checks is Radial menu.exe up to date with latest official AutoHotkey version.
  • Radial menu updates, it checks is RM script up to date with latest official RM version.

[more precise explanation] When RM checks for:

  • AutoHotkey updates, it checks is exe file which is actually running Radial menu.ahk script (A_AhkPath) up to date with latest official AutoHotkey version. User is supposed to run RM by clicking on Radial menu.exe, but depending on how he run RM, exe file which will be checked can be: 1) Radial menu.exe or 2) installed AutoHotkey.exe or 3) some other exe file.
  • Radial menu updates, it checks is RM version number up to date with latest official RM version. RM version number is stored in RMApp library.ahk and can be retrieved by calling RMApp_Version() function.

Folders in RM

  • Icons. A place where you can put icons (images) which will be used in RM items. Remember that icons must be in .png format. Do not use .ico format.
  • Legal. Here you can find Radial menu, AutoHotkey and other licenses. It also contains links to AutoHotkey source code, downloads, and other info.
  • Menu definitions. Contains radial menu definitions, navigator definitions and general settings.
  • My codes. Contains user files which are included in RM’s main code. My functions.ahk and My mouse gestures.ahk have been explained before. For other files in there; open them, and read what is written in comments. In My radial menus.ahk you can load or create additional radial menus and docks inside RM application. My RMShowHotkey conditions.ahk is a place where you can adjust RMShowHotkey’s context-sensitivity; enable or disable (block) it, depending on conditions you specify.
  • Skins. Contains radial menu skins.
  • Utilities. A place where you can put your scripts, portable apps, and other files and folders. Contains some test scripts and other useful stuff.
  • Internal. RM’s internal folder which contains RM source code and other internal stuff. Don’t touch it and never put your stuff in it. It’s contents may be modified without notification.
  • To Delete. This folders appears after updating to a newer version of RM. You can freely delete it because it contains old files and folders which RM doesn’t need nor use anymore.

What’s the purpose of To Delete folder? Some advanced users like to experiment and adjust/modify RM’s internal files (located in RMInternal folder). When Radial menu updater updates RM’s internal files, instead of permanently deleting old files, it will move them to this folder. So if you modified RM’s internal files like RMApp lib.ahkRM2module.ahk or similar, your modifications won’t be lost, and you’ll be able to compare them with new, updated RM files, modify new RM files if you need, and then delete this folder.

Skins

All skins are located in RMSkins folder. You “install” new skin simply by putting the skin folder there. For example; RMSkinsMy new skin.  You can change RM’s skin by selecting Skin & profile changer item in Menu control submenu.

Available skins & previews. RM package comes with a few built-in skins. Additional skins available for download  and skin previews can be found on this page: Screenshots & skins.

 

Designing skin. Skin may consist of 2 components:

  1. Skin (obligatory component) and
  2. Skin + (optional component)

 For example, Merlock’s device skin may consist of 1) Merlock’s device and 2) Merlock’s device + folders inside RMSkins folder.

  1. Skin (obligatory). Here put all skin images. In Skin definition.txt, associate those images with appropriate skin elements and edit other skin attributes. You can’t use any image outside skin folder. Everything you use, must be in this folder.
  2. Skin + (optional). Here you can put custom sounds. In the future, skin animations will probably be located here too. In Skin definition +.txt, associate sounds with RM events; on showhide etc. You can’t use any sound outside skin + folder with one exception – if you specify Internal prior to sound’s filename, skin will use shared, standard sound located in RMInternalSounds. If Skin +Skin definition +.txt does not exist, RM will use will use shared, standard sounds located in RMInternalSounds. If it exists, RM will use custom sounds specified in Skin +Skin definition +.txt.

So, to use custom sounds in specific skin, you have to:

  1. create Skin + folder in RMSkins. For example: Orb of frost +
  2. put your custom sounds in Skin + folder. For example, put there: My sound1.wavMy sound2.wav, etc.
  3. create Skin definition +.txt file in Skin + folder and associate your custom sounds with RM events

Skin definition +.txt contents example:

SoundOnShow =     My sound1.wav

SoundOnHover =    InternalHover.wav

SoundOnSelect =   My sound2.wav

SoundOnHide =     My sound3.wav

SoundOnSubShow =  My sound4.wav

SoundOnSubHide =  My sound4.wav

Skin attributes. I haven’t documented what exactly every skin attribute means and what are the possibilities yet, but quickly;

  • Shrink formula is Shrink := ItemSize*Shrink
  • Trans (except TextTrans) is GDI+ matrix with some extra possibilities. 1 means 100% opaque0.5 means 50% opaqueARGB|0.95|0|0|0.34 means: alpha (transparency) 95%, leave red and green as they are, boost blue. You can also directly pass GDI+ matrix.
  • MenuBackSize and MenuForeSize use add+add-fac+fac- operators.
  • with RadiusSizeFactor you can compress or decompress menu.
  • Offset of MenuBackOuterEllipse is calculated from the outer border of the menu, and Offset of MenuBackInnerEllipse is calculated from the center of the menu

Do not use ItemBacks with built-in shadow. Use ItemShadow instead.

Some built-in functions

RMApp_ExecuteSelectedText()

Executes selected text which represents valid ItemAction. There’s no built-in hotkey for this functionality. It’s up to you to choose a hotkey (or mouse gesture, etc.) which fits your needs best. How to use example:

1) Put this code in RM My codesMy hotkeys.ahk

+F1::RMApp_ExecuteSelectedText()    ; Shift + F1 = Execute selected text

2) Save changes, reload RM

3) Now select any text which represents valid ItemAction and press Shift + F1 hotkey to execute it. For example…

notepad fun RMApp_ShowAboutGui explore RM
%A_Desktop% fun Demo2|selected|text|executed C:
RMHelp.htm RMUtilitiesTest – RM window messages.ahk .doc
sub RMApp_TrayOpenRMFolder http://www.autohotkey.com/ .mp3

RMApp_Redraw()

Redraws all radial menus and docks without reloading whole RM process. Useful if you have RM isn’t visible after resuming from hibernation in Windows 7 problem. It’s up to you to decide how you will call this function. Suggestion: put code below in RMMy codesMy mouse gestures.ahk, save changes and reload RM.

MG_LUR() {  ; mouse gesture left-up-right = Redraw

RMApp_Redraw()

}

Now you’ll be able to call redraw function by making a left-up-right mouse gesture.

RMApp_AutoExecute()

RMApp_AutoExecute() function, which is called auto-execute section in RM Radial menu.ahk, can optionally accept associative array of options.

key description
SplashScreen Set 1 to display “Loading Radial menu …” splash screen or 0 to omit it. Default: 1
TurnOffRM2module Set 1 to automatically call RM2_Off() on  RMApp_AutoExecute() end  or 0 to keep RM2module turned on. Default: 1

Examples:

RMApp_AutoExecute() ; uses default options; displays “Loading Radial menu …” splash screen, and automatically calls RM2_Off() on RMApp_AutoExecute() end

RMApp_AutoExecute({SplashScreen: 0, TurnOffRM2module: 0}) ; uses custom options; “Loading Radial menu …” splash screen will not be displayed, and RM2_Off() will not be called on  RMApp_AutoExecute() end – user must call RM2_Off() later

Inter-process communication

RM and other processes can communicate via 2 IPC mechanisms: 1) Window messages 2) RM live code.

All IPC is done via RM’s hidden Radial menu – message receiver window. This window is supposed to be hidden all the time, but if you want to see how does it look and work, hold down Shift key and select Versions info item from Menu control submenu, or call RMApp_ShowMessageReceiverGui() function.

Window messages

Take a look at this example script: RMUtilitiesTest – RM window messages.ahk. You can control RM by sending windows messages to it. Title of RM’s message receiving window is: Radial menu – message receiver, and its window class is: AutoHotkeyGUI. Message number is: 0x1001, and wParam is as follows:

wParam Description
1 ExitApp
2 Reload
30 Suspend, off
31 Suspend, on
32 Suspend, toggle
40 Sounds, off
41 Sounds, on
42 Sounds, toggle
50 RMShowHotkey, off
51 RMShowHotkey, on
6 MessageReceiver – Execute (to be used in combination with RM live code)

lParam doesn’t matter, leave it blank. To suspend RM by its own code, use RMApp_Suspend(), not Suspend command.

RM live code

With window messages, you can only work with numbers. RM live code allows you to work with strings. It’s not powerful as COM or similar IPC mechanisms, but can do useful things. Please study RMUtilitiesTest – RM live code.ahk to learn how to use it. Also see RMUtilitiesTest – RM info.ahk which shows how you can get info about currently running RM via another stand-alone ahk script or another program.

Events

OnAutoExecute

Fires when RM’s auto-execute section is executed (fires on RM start up). You can monitor it simply by opening RMRadial menu.ahk and putting your code before or after (or both) RMApp_AutoExecute() function.

OnExit

Fires when RM exits (ExitApp). You can monitor it simply by opening RMRadial menu.ahk and putting your code in RMApp_OnExit subroutine. That subroutine must end with ExitApp command! Why? Read AutoHotkey help, OnExit.

OnRMShowHotkey

Fires when you press RMShowHotkey (Rbutton by default). It fires before showing RM’s main menu, executing mouse gestures, etc. User can monitor this event via RMApp_OnRMShowHotkey() function. By default, RMApp_OnRMShowHotkey() does not exist in the code, so if user wants to monitor this event, he has to create this function anywhere in his code.

 In the moment when this event fires, if RMApp_OnRMShowHotkey() function;

  • does not exist in the code, than RM continues to execute its internal code which is responsible for showing RM’s main menu, executing mouse gestures, etc.
  • exists in the code, than RM will execute RMApp_OnRMShowHotkey() function first. If this function returns:

o   string stop, than RM will not continue executing its internal code which follows after that, which is responsible for showing RM’s main menu, executing mouse gestures, etc.

o   blank value, than RM will continue executing its internal code which follows after that

Some basic info like ActiveWinID := RMApp_Reg(“ActiveWinID”), which is explained in RMMy codesMy mouse gestures.ahk, is collected before OnRMShowHotkey event fires, and is available for use in RMApp_OnRMShowHotkey()  function, and in other user’s code too.

Example 1. This example shows how to quickly highlight selected text in MS Word document. Put code below in RMMy codesMy functions.ahk, save it and reload RM.  Click & drag with LButton to select some text and while holding it down, click with Rbutton (RMShowHotkey). Note: this example will not work in MS Word Starter, because you can’t use COM there.

RMApp_OnRMShowHotkey() {      ; monitors OnRMShowHotkey event

WinGetClass, ActiveWinClass, % “ahk_id ” RMApp_Reg(“ActiveWinID”) ; get active window’s class name

 

; if it is MS Word (OpusApp) and LButton is down (and RMShowHotkey is already down – it triggered this event)

if (ActiveWinClass = “OpusApp” and GetKeyState(“LButton”, “p”) = 1) {

Send, {LButton up}

try ComObjActive(“Word.Application”).Selection.Range.HighlightColorIndex := 7 ; yellow highlight

return “stop”     ; tells RM to stop here, so it will not execute its internal code which follows after that

}

; in all other cases function returns blank value, and that tells RM to continue executing its internal code

}

Example 2. This example shows interesting way to copy and paste text. Put code below in RMMy codesMy functions.ahk, save it and reload RM.

  • to copy text, click & drag with LButton to select some text and while holding it down, click & drag UP with Rbutton (RMShowHotkey) until ToolTip Copy appears. Release both keys.
  • to paste text, click down with LButton in a position where you want to paste text and while holding it down, click & drag DOWN with Rbutton (RMShowHotkey) until ToolTip Paste appears. Release both keys.

Doing it is actually simpler than it looks from explanation above. Drag UP = put it up to clipboard, drag DOWN = put it down from clipboard. You can also expand the mouse gestures system here.

RMApp_OnRMShowHotkey() {      ; monitors OnRMShowHotkey event

if (GetKeyState(“LButton”, “p”) = 1) { ; if LButton is down (and RMShowHotkey is already down – it triggered this event)

Send, {LButton up}      ; prevents selecting text when user drags with RMShowHotkey (RButton by default)

StartY := RMApp_Reg(“y”), RMShowHotkey := RMApp_Reg(“RMShowHotkey”)     ; get info from RM’s registers

CoordMode, mouse, Screen

 

; monitor user’s UP and DOWN mouse movements while he is holding RMShowHotkey down (RButton by default)

While (GetKeyState(RMShowHotkey, “p”) = 1) {

Sleep, 20                           ; prevents high CPU load

MouseGetPos,,EndY                   ; get current Y position

 

if (StartY – EndY > 8) {            ; if user did UP movement – copy

RMApp_ToolTipRA(“Copy”, 500)  ; displays “Copy” tooltip which will be removed after 500 milliseconds

Send, ^c                      ; copy

return “stop”                 ; tells RM to stop here

}

else if (StartY – EndY < -8) {      ; if user did DOWN movement – paste

RMApp_ToolTipRA(“Paste”, 500) ; displays “Paste” tooltip which will be removed after 500 milliseconds

Send, ^v                      ; paste

return “stop”                 ; tells RM to stop here

}

}

; in all other cases function returns blank value, and that tells RM to continue executing its internal code

}

}

BeforeExecuteItem

Fires after item is selected, but before its item action is executed. If item has no action, event will not fire. User can monitor this event via RMApp_BeforeExecuteItem() function which he has to make somewhere in his code. If such function doesn’t exist (default), event will not be monitored. User’s function has to receive 3 parameters. Example:

RMApp_BeforeExecuteItem(ByRef ItemAction, MenuNum, ItemNum) {

ToolTip, % ItemAction “`n” MenuNum “`n” ItemNum

if ItemAction contains Virus

{

MsgBox, 292, , % “Are you sure you want to execute`n” ItemAction

IfMsgBox, No

return “stop”     ; tells RM to stop here

}

; in other cases function returns blank value, and that tells RM execute item action

}

If this function returns string stop, item action will not be executed. ItemAction is ByRef parameter which means you can directly ad hoc modify what will be executed.

AfterExecuteItem

Fires after item action was executed. User can monitor this event via RMApp_AfterExecuteItem() function which he has to make somewhere in his code. If such function doesn’t exist (default), event will not be monitored. User’s function has to receive 3 parameters. Example:

RMApp_AfterExecuteItem(ItemAction, MenuNum, ItemNum) {

ToolTip, % “Just executed:`n” ItemAction “`n” MenuNum “`n” ItemNum

}

OnReceiveMessage

Fires when RM receives a message. Read about Sending windows messages to RM. User can monitor this event via RMApp_OnReceiveMessage() function which he has to make somewhere in his code. If such function doesn’t exist (default), event will not be monitored. User’s function has to receive 1 parameter. Example:

RMApp_OnReceiveMessage(ByRef Message) {

ToolTip, % Message

}

If this function returns string stop, RM will not continue execute its internal code which is responsible for built-in reacting on received messages. Message can be integer between 0 and 4294967295. Currently, RM uses message numbers from 1 to 51. If you want to have your custom messages, send them to RM, and handle them via OnReceiveMessage event, it’s recommended to use numbers higher than 1000. Message is ByRef parameter, which means you can directly ad hoc modify received message.

Events – tips & tricks

RMApp_Obj().Events.BeforeExecuteItem := “”                  ; stop monitoring event

RMApp_Obj().Events.BeforeExecuteItem := Func(“customfunc”)  ; start monitoring event through another function

; this logic applies on OnRMShowHotkey, BeforeExecuteItem, AfterExecuteItem, OnReceiveMessage events

Other info

“It’s nice but… it’s too complicated.” When I was making RM, I wanted to create a program that can be customized a lot, and can do a lot. I’m considering all those features as richness of the program, not as unnecessary complication! People who are new to RM might get confused when they see so many possibilities and think; “That’s too complicated, forget it”. That’s wrong attitude. Here is the catch; in the beginning, just deal with basic things, and ignore all other. Go slowly, step by step. Don’t let the freedom in RM confuse you.  In RM’s radial menu component, in more than 90% cases you will only have to change just 2 basic things; 1) item’s text or icon and 2) item’s action, and that’s it! I think it can’t be simpler.

Explore advanced features later, after few weeks or months or never. You don’t have to use and understand all of them. It’s up to you to decide how deep you want to go in both Radial menu and AutoHotkey.

How do I “uninstall” RM? Just delete RM folder. RM is a clean, portable application – it does not write in registry and it does not create new files or folders outside RM folder. So if you delete it, there will be no mess left behind. Note that you must exit RM prior to deleting it’s folder.

Supported operating systems. RM works on: Windows XP, Vista, 7, 8, 8.1, 10, including both 32-bit and 64-bit versions.

32-bit and 64-bit Radial menu. Radial menu.exe is renamed AutoHotkey Unicode 32-bit. If you have 64-bit system, and you want to run 64-bit RM version on it, do the following:

  1. exit RM
  2. delete Radial menu.exe
  3. download AutoHotkey Unicode x64 zip archive, extract AutoHotkey.exe,  rename it to Radial menu.exe, and put it in the RM folder

That’s it. Next time you’ll run RM, it will be running on 64-bit AutoHotkey. Note that you can run 32-bit RM on both 32-bit and 64-bit systems, while 64-bit RM runs only on 64-bit systems.

Do I need to know how to program in AutoHotkey if I want to use Radial menuIf you’ll use RM just to launch applications, other files, and folders, or if you’ll do just some basic – intermediate things with it, than you don’t have to know nothing about programming in AutoHotkey. If you’ll want to do something more than that, then you’ll need to know some basic things about programming in AutoHotkey.

Radial menu is suitable for both non-programmers and advanced AutoHotkey programmers. And another good thing is that AutoHotkey scripting/programming language is suitable for both non-programmers and advanced programmers.

 

What are the limits of RM as application? What can I do with it? Everything you can do with AutoHotkey, you can do with Radial menu too. So, you can do almost anything you wish with it; from simple launcher to super advanced system of control and automation. One of RM’s greatest features is that it is highly extendible – you can take/write almost any script/function/module/library/class, and make it part of RM.

Total number of profiles, menus, rings, items. Number of profiles is unlimited. In one profile, you can have:

  • 1 main menu and up to 60 submenus
  • up to 60 items (4 rings) per menu
  • up to 3660 items in total (up to 60 items per each menu)

Total number of items per menu and item layout can be modified by changing ItemLayoutPerRing. If you’ll load or create additional radial menus in My radial menus.ahk, total number of menus and items will be even higher.

Some menu design & organization suggestions. It’s recommended to use up to 3 rings in main menu and up to 2 (exceptionally 3) rings in submenus. Menus with 4 rings may look too large, they may be hard to organise, etc. Frequently launched items should be located near the center of menu – in 1. and 2. ring. You don’t have to put shortcuts to everything on your computer in RM, just to things that you use often. Use separators. If some menu consist of 8 or less items, make it one-ringer, it should look better. In multi-ringers, you can use dummy items (item that hasn’t nor action nor submenu defined, just text or icon) to make nice symmetrical layout. In main menus, put items with submenus in 1. and 2. ring.

Why is release to select better than click to select method? Because in release to select method:

  • you have to click less to select item
  • item in main menu that has both action and submenu defined can launch something (by releasing Rbutton) and open submenu (by clicking it with Lbutton).  In click to select method, such item will open submenu when you click it, but you can’t launch its action. Example: Item4 in Main profile; it has Action= %A_WinDir%explorer.exe and Submenu= Folders. Item in main menu that has its own submenu should launch something that you are using most often from its submenu. For example, Comp control item in main menu may launch RWRM RMInternalCodesHibernate.ahk if you are using this most often among all other items in Comp control submenu. It will save you one click and one mouse movement.

About my coding style. I initially started to develop RM in AutoHotkey Basic, but later, when RM was almost finished, I discovered AutoHotkey_L (which than become official AutoHotkey) and I switched to _L style. I wasn’t motivated to rewrite all basic style solutions to _L style, and that’s why RM code sometimes contains a strange mixture of Basic and _L code.

Want to help? Anyone who wants to help is very welcome. You can help by:

  • giving user to user support – answering to other RM user’s questions on forum
  • creating new or improving existing skins and sounds
  • presenting new ideas and suggestions
  • writing new or improving existing codes
  • if you like RM, you can promote it, but promote AutoHotkey too
  • giving feedbacktestingfixing, checking spelling & grammarother

Everything must be legally clean.

Forum: Radial menu scripts topic on AutoHotkey forum.

Website: Radial menu website.

Want to donate? Look here.

Some questions and info from the forum.

Known issues.

  • RM isn’t visible after resuming from hibernation in Windows 7. It looks that this problem comes from drivers inconsistency. You’ll have to call RMApp_Redraw() function and everything will be fine again. More info here and here.
  • Item rendering problem

人已赞赏
AHKV1办公

CapsLockX - 像黑客一样操作电脑!【雪星】

2021-2-19 21:05:19

AHKV1游戏

磁水多开键鼠同步工具

2021-2-21 15:07:29

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索