Keyboard Shortcut XML file simplifying & merging & resetting to original

I had made some additions to Revit KeyboardShortcuts.xml file and the file is quite big. Only some of the functions have a Keyboard Shortcut . So I wanted to create a KeyboardShortcuts.xml file that would only have my additions, so that when a person merged them in they were not going to bloat the ones they already have.

To try and minimise conflict I have made all my Keyboard Shortcut min 3 and up to 5 digits long. I may need to adapt some of the code so that they are as long as they can be so they are easily removed if required.

I was also looking at getting the original Keyboard Shortcut DEFAULT settings and found a Autodesk Article on how to do this , actually its quite easy.

I tried doing a filter with the Keyboard Shortcut s pop up to only show defined ones , then tried exporting Keyboard Shortcuts but it only exported the whole file, regardless of whether it had Keyboard Shortcuts or not.

PowerKey4Revit                              Free 30 day Trial

  • Speed up the tedious stuff and enjoy designing and documentation more
  • Works in all versions of Revit
  • Information to PROVE your increased speed
PowerKey4Revit Free 30 day Trial
PowerKey4Revit VIDEO

Cleaning a .XML file with Excel

I initially tried to slim down the .XML file by using Notepad++ and made a reasonable effort with it. I then found that you can open an .XML file in Excel, use filters on it and then save it back as a .XML file.

I found there were a few steps to take but in the end it was the quickest way to do all the work.

I was initially going to try and split the imported cells out using split() but the “Shortcut=” spread across multiple columns and so it was hard to clean up.

Mty second attempt was to use find/replace, but what I really needed was Find & delete all the items not in the Find query. In the end the Filter was the method I used, following the video below and looking for NOT CONTAINS with *Shortcut=*” as the search. So it found every other row without the “Shortcut=” in the row.

Then I could delete all of those rows and only be left with the ones I wanted. I found the video below a really easy method to get rid of all the empty rows:

Then I saved the Excel Sheet to a .xml file format.

I then further filtered out the Shortcut= Column to only shorter 1 or 2 letter keys and then deleted those , then followed the procedure of deleting those empty rows as per the vid above. Some Keyboard Shortcut s had multiple keys and they were shown as ZE#ZA#ZOO1 so these stayed and had to be deleted manually.

After figuring out the process it was easy to clean up the file to the size I need, now I can test those Keyboard Shortcuts in a merge with my Keyboard Shortcut file and also reset my Keyboard Shortcut file to the original and test it on that one too.

Resetting KeyboardShortcuts.xml to original file

There is a main article on Keyboard Shortcuts and options Keyboard Shortcuts Info

There is also an article on resetting Keyboard Shortcuts back to default , which is very easy to do Reset Revit Keyboard Shortcuts to Default

When you import a KeyboardShortcuts.xml file you have the option to either OverWrite or merge. See this article Importing Keyboard Shortcuts File

End Comments

This was a useful exercise to be able to review my Keyboard Shortcuts and also change them for others to use. The process will come in handy when I adapt some of them later so I’ll need to go through the whole process again.