Custom menu for a third party program needs adjustments

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
A Keymaker
Posts: 455
Joined: 31 May 2022, 13:46
Location: Donjon du Château de Mérovingien

Custom menu for a third party program needs adjustments

02 Mar 2023, 11:14

All I was able to cook up so is this code

Code: Select all

F4::
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Sa where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Sb where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Ka where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Kb where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN 01 where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN 02 where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN 03 where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Color, 0xff0000, 0x00ff00 ; set foreground and background colors
Menu, HereWillBeNameOfMyMenu, Show
return

HereWillBeNameOfMyMenuAction:
ClipSaved := ClipboardAll
Clipboard := RegExReplace(A_ThisMenuItem, "^PASTE IN (.*) where focus is$", "$1")
Send, ^v
Sleep 55
Clipboard := ClipSaved
return

#IfWinActive, ahk_exe AutoHotkey.exe
LButton::
If (WinExist("ahk_class #32768"))
{
    WinClose
    return
}
else
    return
which results with such menu

Image

when I press F4; from which I can choose entries with LMB in order to paste in what I see / choose or from which I can escape with Esc or by clicking anywhere outside it with any mouse button


The problem with it that I have is that:

1] I see no green color i.e. 0x00ff00

2] I failed at controlling size of font

3] How do I remove that white color column from the left side of menu?

4] How to not use the Clipboard of the OS?


Or maybe it could be easier and faster if I would just use program with GUI for building such menus - can anyone point me out it the right direction?


[Mod action: Topic moved from main section which is now for v2. Please post in the appropriate forums going forward.]
Last edited by A Keymaker on 30 Jul 2023, 09:27, edited 2 times in total.
User avatar
lmstearn
Posts: 695
Joined: 11 Aug 2016, 02:32
Contact:

Re: My menu for third party programs needs adjustments

02 Mar 2023, 23:17

Hi. :)
  1. Only background colours are available for menus
  1. Changing fonts in menus isn't easy - see this thread.
  1. White strip on the left is another bugbear - see this thread.
  1. What's wrong with the Windows clipboard? An alternative is the OLE mechanism- if that isn't what you want, then it's building something from the ground up which is probably not going to be anything like what's currently on offer any time soon.
Here's a slightly modified version of above code:

Code: Select all

F4::
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Sa where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Sb where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Ka where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN Kb where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN 01 where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN 02 where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, PASTE IN 03 where focus is, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Add, Exit, HereWillBeNameOfMyMenuAction
Menu, HereWillBeNameOfMyMenu, Color, 0x00ff00 ; set foreground  color
Menu, HereWillBeNameOfMyMenu, Show
return

HereWillBeNameOfMyMenuAction:
	if (A_ThisMenuItem == "Exit")
	ExitApp
ClipSaved := ClipboardAll
Clipboard := RegExReplace(A_ThisMenuItem, "^PASTE IN (.*) where focus is$", "$1")
Send, ^v
Sleep 55
Clipboard := ClipSaved
return

#IfWinActive, ahk_exe AutoHotkey.exe
LButton::
	If (WinExist("ahk_class #32768"))
	WinClose
return
For a gui builder, try Adventure - General-Purpose IDE, Lightweight Text Editor. :)
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
User avatar
A Keymaker
Posts: 455
Joined: 31 May 2022, 13:46
Location: Donjon du Château de Mérovingien

Re: My menu for third party programs needs adjustments

30 Jul 2023, 09:24

lmstearn wrote:
02 Mar 2023, 23:17
Hi.
[...]
Thank you for your input

But as
A Keymaker wrote:
02 Mar 2023, 11:14
[...]
maybe it could be easier and faster if I would just use program with GUI for building such menus - can anyone point me out it the right direction?
[...]
I have settled for now on using the freeware Quick Access Popup: https://www.quickaccesspopup.com

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], GeneralAdmission and 115 guests