News:

Welcome to our NEW forum! We invite you to sign up today
so it can grow to be a valuable resource to all Toolbox users!

Main Menu

Automating mouse menu entries

Started by oblivion, December 08, 2025, 12:50:11 AM

Previous topic - Next topic

oblivion

I like controllable menus. I have a fairly huge -- but structured thematically -- menu, created with

(Start)
TIP: Copy from Start to End to paste into an action.
0001 Mouse: Move to desktop position "600,600"
0002 Alert: Show a mouse menu "[[Everything on a menu]]
(End)

with the menu itself defined in step 2.

Thing is, as well as the submenu names and indentation info -- simply managed and beautifully straightforward -- each actual menu entry looks something like this:

InControl,dos:C:\somepath\Incontrol\incontrol.exe,icon=C:\somepath\Incontrol\incontrol.exe

and building those, for larger menus, gets a bit tedious.

So I have a utility that helps.

(Start)
TIP: Copy from Start to End to paste into an action.
0001 String: Assign "clip$"
0002 String: Replace regex text "$3,dos:$1$3$4,icon=$1$3$4 from ^(.*[\\/])(["']?)([^\\/]+?)(\.[^\\.]+)?\2$"
0003 String: Replace text ""="
0004 Clipboard: Assign text "string$"
(End)

So you copy the name and path of the executable you want a menu entry for to the clipboard. I cheat a bit -- my file manager of choice (xyplorer) has a keystroke for that but I suspect it'd be fairly simple to fetch that from file properties. I might have to see if I can come up with that bit to strengthen this a bit...

Anyway, this routine takes the program name and path from the clipboard and turns that into a menu entry you can paste into your menu. The only element left to manually alter is the title, which defaults to the program name but might want to be slightly more, er, human centred.

The bulk of the work is done with that regex expression -- and again, although the regex was mine, Paul had to do some work with Toolbox to actually make it work for me.

The menu is about the first thing I invoke after powering up my laptop, so an easy way to edit it has been really useful.

oblivion

Quote from: oblivion on December 08, 2025, 12:50:11 AMI might have to see if I can come up with that bit to strengthen this a bit...

This step would help with that:

(Start)
TIP: Copy from Start to End to paste into an action.
0001 Alert: Ask for a file as "exe"
(End)

So we can add a file browser to the above action. That gives us the ability to put the cursor exactly where the new menu entry is going to be and invoke this action, so we might as well also add a paste command to the end!

(Start)
TIP: Copy from Start to End to paste into an action.
0001 Alert: Ask for a file as "exe"
0002 String: Assign "alert$"
0003 String: Replace regex text "$3,dos:$1$3$4,icon=$1$3$4 from ^(.*[\\/])(["']?)([^\\/]+?)(\.[^\\.]+)?\2$"
0004 String: Replace text ""="
0005 Clipboard: Assign text "string$"
0006 Keyboard: Paste ""
(End)