Meanwhile I have quite some hotkeys or shortcuts to
1. phrases and text snippets in two languages for sentences or paragraphs which are used repeatedly
2. functions
These sum up to a total amount of 350. Since it is impossible to remember 350 shortcuts/hotkeys, I am looking for a solution how to access some of them (about 30) easily.
Some simple examples:
::ENgreet4::Your assistance in this matter is greatly appreciated and I look forward to your soonest reply
::ENrf::Please do not hesitate to contact us if you have any questions.
::bra::Best regards{Enter}{Enter}Alex
I thought, using the <CTRL> and <Mouse right klick> opening a menu (eventually with sub-menu(s) for languages, functions) would be an option.
Access the right mouse button is easy but how can I generate a menu showing a short description of the hotkey and execute the hotkey if I klick on it.
I would like to have my "EasyAccess" Menu somehow like this:
EasyAccessSetup:
Menu, EasyAccess, Add, Greetings, Sendkeys ENgreet4
Menu, EasyAccess, Add, Contact us for questions, Sendkeys ENrf
Menu, EasyAccess, Add, Best regards, Sendkeys bra
^RButton::
Menu, EasyAccess, Show
But that does not work. Surely because I did not understand how
- to properly generate a menu
- to call a shortcut defined in one AHK script from another AHK script.
Could you please help me? Thank you and best regards
Alex
Easy access to multiple hotkeys Topic is solved
Re: Easy access to multiple hotkeys
Code: Select all
Menu, short, Add, Hello, Go
Menu, short, Add, 123 abc, Go
^RButton::Menu, short, Show
Go:
Send %A_ThisMenuItem%
Return
How can a menu item call a hotkey?
Thank you for your reply Mikey!
What your menu does is print the text "Hello" if I click on the first menu-item.
What I was looking for is that the klick on the menu-item calls the defined hotkey.
To make the long story short: How can a menu item call a hotkey?
Example:
My AHK files contains the following hotkeys:
::ENgreet4::Your assistance in this matter is greatly appreciated and I look forward to your soonest reply
::ENrf::Please do not hesitate to contact us if you have any questions.
::brm::Best regards{Enter}{Enter}Mikey
I would like to have the menu
- sending out the defined hotkey (example "brm")
- and then the other AHK script, where the hotkeys are defined (or in the same script file) is triggered to write the long text "Best
regards{Enter}{Enter}Mikey"
Working but too complicated and error prone:
What works but not seems to be an efficient way is the following code:
On the one hand I have to work with endless jump targets and on the other hand I have to double the text. Both error prone.
Do you know a possibility calling a AHK hotkey with an AHK menu item?
Best regards
Alex
What your menu does is print the text "Hello" if I click on the first menu-item.
What I was looking for is that the klick on the menu-item calls the defined hotkey.
To make the long story short: How can a menu item call a hotkey?
Example:
My AHK files contains the following hotkeys:
::ENgreet4::Your assistance in this matter is greatly appreciated and I look forward to your soonest reply
::ENrf::Please do not hesitate to contact us if you have any questions.
::brm::Best regards{Enter}{Enter}Mikey
I would like to have the menu
- sending out the defined hotkey (example "brm")
- and then the other AHK script, where the hotkeys are defined (or in the same script file) is triggered to write the long text "Best
regards{Enter}{Enter}Mikey"
Working but too complicated and error prone:
What works but not seems to be an efficient way is the following code:
Code: Select all
Menu, short, Add, Ask for assist, HL_ENgreet4
Menu, short, Add, Contact us for questions, HL_ENrf
Menu, short, Add, Best regards, HL_brm
^RButton::Menu, short, Show
HL_ENgreet4:
SendInput Your assistance in this matter is greatly appreciated and I look forward to your soonest reply
::ENgreet4::Your assistance in this matter is greatly appreciated and I look forward to your soonest reply
Return
HL_ENrf:
SendInput Please do not hesitate to contact us if you have any questions.
::ENrf::Please do not hesitate to contact us if you have any questions.
Return
HL_brm:
;The following does not work, just for demonstration
SendInput bra{Space}
::bra::Best regards{Enter}{Enter}Mikey
Return
Do you know a possibility calling a AHK hotkey with an AHK menu item?
Best regards
Alex
Re: Easy access to multiple hotkeys
What you are referring to are hotstrings, not hotkeys. You wouldn’t put the definition of the hotstring (the line with the :: in it) in this script if you’re trying to trigger the hotstring in another script. And you can’t execute a hotstring definition by putting it in the flow of your code like you showed. You should just be using the Send (or SendInput) command to send the abbreviation part to simulate typing just that part and let the other script expand it. You will need to use #InputLevel and SendLevel in your scripts to allow the hotstrings to be triggered by what is sent by a script. See the documentation links for more information.
Re: Easy access to multiple hotkeys Topic is solved
Code: Select all
Menu, short, Add, Ask for assist, HL_ENgreet4
Menu, short, Add, Contact us for questions, HL_ENrf
Menu, short, Add, Best regards, HL_brm
^RButton::Menu, short, Show
::ENgreet4::
HL_ENgreet4:
SendInput Your assistance in this matter is greatly appreciated and I look forward to your soonest reply
Return
::ENrf::
HL_ENrf:
SendInput Please do not hesitate to contact us if you have any questions.
Return
::brm::
HL_brm:
SendInput Best regards
Return
Re: Easy access to multiple hotkeys
Not better or worse, but another method.
Code: Select all
phrase
:= {"Ask for assist"
: ["engreet4" , "Your assistance in this matter is greatly appreciated and I look forward"
. " to your soonest reply"]
, "Contact us for questions"
: ["enrf", "Please do not hesitate to contact us if you have any questions."]
, "Best regards"
: ["brm", "Best regards"]}
For k, v in phrase {
Menu, txt, Add, %k%, Go
Hotstring("::" v.1, v.2)
}
^RButton::Menu, txt, Show
Go:
SendInput % phrase[A_ThisMenuItem].2
Return
Re: Easy access to multiple hotkeys
Thank you braunbaer, that works perfect and at least eliminates one possible error source:
Mikey thank you as well for your help and for the lesson !
Spoiler
Mikey thank you as well for your help and for the lesson !