Macropad shortcut key issue

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
expiredparrot
 
Posts: 3
Joined: Sun May 22, 2022 6:46 am

Macropad shortcut key issue

Post by expiredparrot »

Hi, total beginner here, maybe someone can point out the issue.
I started modifing the macropad hotkeys example for Adobe Illustrator for Windows to see if it will work for other software.
I have an issue with the shortcut CTRL - 1 that I would like to use in trading software called TC2000.
After writing it in and saving to the macropad this particular command doesnt work in the software. If I test that hotkey on the macropad with google chrome then it jumps to the first open tab, which confirms that its working. Pressing CTRL-1 on my keyboard works in TC2000.
What could be the cause? Thanks
Attachments
Screenshot 2022-05-22 135652 - macropad.jpg
Screenshot 2022-05-22 135652 - macropad.jpg (378.39 KiB) Viewed 148 times

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: Macropad shortcut key issue

Post by neradoc »

Try adding making it hold the shortcut while you hold the key. Maybe the software needs it to be held a little bit.
When you put a string in a shortcut, the corresponding key is not held (it simulates typing it, which releases the key immedidately).

Code: Select all

[Keycode.CONTROlL, Keycode.ONE]
You could also add a delay to make sure the key is held, like 0.1 seconds here.

Code: Select all

[Keycode.CONTROlL, Keycode.ONE, 0.1]
If that doesn't help, I don't know what the issue could be.

User avatar
expiredparrot
 
Posts: 3
Joined: Sun May 22, 2022 6:46 am

Re: Macropad shortcut key issue

Post by expiredparrot »

thanks neradoc. i think you are correct. I couldn't make it work by playing with the delay just yet.

How would you code it to press 1 while holding CTRL?

Thanks

User avatar
neradoc
 
Posts: 542
Joined: Wed Apr 27, 2016 2:38 pm

Re: Macropad shortcut key issue

Post by neradoc »

expiredparrot wrote:thanks neradoc. i think you are correct. I couldn't make it work by playing with the delay just yet.

How would you code it to press 1 while holding CTRL?

Thanks
Depends what you mean, the way the hotkeys code works it presses the keys in order, normally as fast as possible, and releases them when you release the key. If you want to hold ctrl a little bit before, and a little bit after pressing 1 you can use the minus sign to release a key.
This for example would press ctrl, wait 100ms, press 1, wait, release 1, wait, release ctrl, and does not hold anything (so it doesn't matter when you release the macropad's key).

[Keycode.CONTROL, 0.1, Keycode.ONE, 0.1, -Keycode.ONE, 0.1, -Keycode.CONTROL]

User avatar
expiredparrot
 
Posts: 3
Joined: Sun May 22, 2022 6:46 am

Re: Macropad shortcut key issue

Post by expiredparrot »

Thanks Neradoc.

It works!!!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”