SendKeys not working for shortcuts in Revit 2019?

SendKeys not working for shortcuts in Revit 2019?

rzlazo
Contributor Contributor
1,311 Views
4 Replies
Message 1 of 5

SendKeys not working for shortcuts in Revit 2019?

rzlazo
Contributor
Contributor

hi guys i having troubles using System.Windows.Forms.Sendkeys to activate keyboard shortcuts in Revit 2019, i can make F1 and Delete work but if i try to send any Shortcut(WN,DR,WA....) to create or modify elements it just wont work.

the weird thing is that i have this working in Revit 2018!. any ideas if something changed in the way the API takes shortcut info ?

 

any info will be very welcome!

 

best regards

Ricardo

0 Likes
Accepted solutions (1)
1,312 Views
4 Replies
Replies (4)
Message 2 of 5

cwaluga
Advocate
Advocate

Revit seems to be mostly WPF now. Perhaps this is the reason why the old way does not work. Also, I would never use your method, since it depends on configurable shortcuts (although hardly anybody ever changes them). You can invoke most things using PostCommand instead.

0 Likes
Message 3 of 5

rzlazo
Contributor
Contributor

Thanks for the answer man! didnt knew that mayor change in revit.

 

so what im trying to do is to implement a radial menu in which users can configure and call so save a second or two each time they execute a command. so i need to use shortcuts for this since i cant think of any other way.

 

do you know any other alternative to SendKey that i can try on ? any info is appreciate it.

 

thanks!

0 Likes
Message 4 of 5

cwaluga
Advocate
Advocate
Accepted solution

Did you check PostCommand mentioned above? You can invoke almost every UI command in this way. Check the following links:

 

PostCommand

LookupPostableCommandId

PostableCommand

 

0 Likes
Message 5 of 5

rzlazo
Contributor
Contributor

Yeah the PostCommand is Working i will use this as a temp solution. i know there must be a way to make it work since the Radial menu that comes with 3D Connection space mouse uses keyboard shortcuts and it does work in Revit 2019.

 

the reason i prefer key shortcuts is because i want to run it as an independent app from revit this way when users call the menu it does not matter if they are in sketch mode or similar, they can always use the tools on the radial menu.

 

but good call man Thanks!

0 Likes