HOW TO CREATE KEYBOARD SHORTCUT FOR TO TURN ON/OFF "QUICK CLICK ENTER"

HOW TO CREATE KEYBOARD SHORTCUT FOR TO TURN ON/OFF "QUICK CLICK ENTER"

Ygamedy
Contributor Contributor
1,383 Views
3 Replies
Message 1 of 4

HOW TO CREATE KEYBOARD SHORTCUT FOR TO TURN ON/OFF "QUICK CLICK ENTER"

Ygamedy
Contributor
Contributor

Hi everyone,

 

As the title say, I would like to know how to create a keyboard shortcut  that would turn on/off the "Quick click enter" in the right click customization. (See attach file)

It's a bit annoying to always have to go in the menu to turn it on/off
If you have other idea let me know

I'm using Autocad Electrical 2021


Thank you

 

Right click - Quick enter shortcut.jpg

0 Likes
1,384 Views
3 Replies
Replies (3)
Message 2 of 4

JBerns
Advisor
Advisor

@Ygamedy,

 

I developed a solution. I would welcome the input of others.

 

The environment variable, ContextMenus, has various bit values to control which right-click menus are displayed. Bit 16 toggles the time-sensitive (quick) option.

 

FYI - Kudos to the Hyperpics site for having the information on the ContextMenus environment variable.

http://www.hyperpics.com/downloads/resources/customization/autolisp/AutoCAD%20Environment%20Variable... 

 

The code below checks the state of bit-16 and toggles as needed.

Note that ContextMenus requires a string, not an integer.

 

Step 1 - Create AutoLISP to toggle the time sensitive right-click

(defun ToggleTimeSensitiveRightClick ()
  (if (= (logand (atoi (getenv "ContextMenus")) 16) 16)
    (setenv "ContextMenus" (itoa (- (atoi (getenv "ContextMenus")) 16)))
    (setenv "ContextMenus" (itoa (+ (atoi (getenv "ContextMenus")) 16)))
  ) ;_if
) ;_defun

Save this code to an AutoCAD Support Path.

 

Step 2 - Create keyboard shortcut

Using the CUI command, I created a custom command. I added this command to the keyboard shortcut group. (I would recommend that you add this to a personal or custom menu, not the AutoCAD menu)

I assigned a keyboard shortcut to the command. (see attached image)

 

Step 3 - Use

Now when I press CTRL+SHIFT+R, the time-sensitive right-click is toggled by the AutoLISP routine.

 

 

It may be possible to place the entire AutoLISP code into the custom command macro, but I went with an external LISP routine as the first solution.

 

You will need to save and load this AutoLISP routine each time when you start AutoCAD. There are plenty of on-line examples for that.

 

I hope this is helpful. I welcome your feedback.

 

 

Regards,

Jerry

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
Message 3 of 4

Kent1Cooper
Consultant
Consultant

@JBerns wrote:

....

I developed a solution. I would welcome the input of others.

....

(defun ToggleTimeSensitiveRightClick ()
  (if (= (logand (atoi (getenv "ContextMenus")) 16) 16)
    (setenv "ContextMenus" (itoa (- (atoi (getenv "ContextMenus")) 16)))
    (setenv "ContextMenus" (itoa (+ (atoi (getenv "ContextMenus")) 16)))
  ) ;_if
) ;_defun

....


This is a good application for the (boole) function, which is hard to understand, but in this context the 6 operator in it will toggle a bit value on or off -- if it's part of the current value, it returns it with that bit subtracted, or if it's not, it returns it with that bit added.  So it's not necessary to use an (if) function to check whether or not  it's part of the value already, and then do a different calculation for each possible result.  It can be toggled with one operation, whatever the current value:

(defun ToggleTimeSensitiveRightClick ()
  (setenv "ContextMenus" (itoa (boole 6 (atoi (getenv "ContextMenus")) 16)))
) ;_defun

 

Kent Cooper, AIA
0 Likes
Message 4 of 4

JBerns
Advisor
Advisor

@Kent1Cooper,

 

I did try the boole function, but as you said, it can be hard to understand. I thought this could be the best toggle tool.

 

Thanks for the simplified code. This code could easily fit in the command macro, thus eliminating the need for an external LISP file, and the need to load it each time. Well done!

 

@Ygamedy,

We would welcome you to Accept this solution if it answers your question. 

 

 

Regards,

Jerry 

-----------------------------------------------------------------------------------------
CAD Administrator
Using AutoCAD & Inventor 2025
Autodesk Certified Instructor
Autodesk Inventor 2020 Certified Professional
Autodesk AutoCAD 2017 Certified Professional
0 Likes