KeyCommand Utility - Now Testing Mac Support

UPDATE: 11/13/2013: New version with an updated css that uses smaller fonts. Added a “.” to the empty cells.

There is now a bit of script that lets you more easily choose MAC or PC

#change these two values to identify MAC or PC
my @mods = @PCmods;  #set to @MACmods or @PCmods  case senstive
my @abrs = @PCabr; #set to @MACabr or @PCabr  case senstive

Find this section and set the value after the = sign.

Typical disclaimer - this program isn’t designed to do anything useful. If you accidently get it to do something you find agreeable, then that’s a bonus. Should running it on your computer ruin your parents credit rating or modify the future beyond your ability to live in it (FZ reference FTW), that’s on you.

perl script linked at the bottom of this post
Put the two files from the zip at the bottom of this post, in the directory that has your Key Commands.xml file in it.

Run the script
It will create a KeyCommands.html file
Open KeyCommands.html in your browser of choice.
Bask in the glory of my L33T Perl skillz…

There is a css file with a “background-color: xxxx” value for each command class of command. You can use internet colors or hex color values. Google css background-color for explanation of choices.

NOTE: There are some odd keyboard choices like ‘-’ and ‘+’ that are not treated normally. For example + should really be ‘SHIFT+=’. But because the + is treated as it’s own symbol, there is a + row that can only ever have 1 command mapped to it. And you can never have a ‘SHIFT+=’. Hope that makes sense.

NOTE 2: If you hover your mouse over a command, it will show you the complete name as it is in the Cubase key command list like below;

genCommand.zip (3.08 KB)

Thanks a lot !

As I wasn"t a cubase.net forum yet at this time (september 2005), I never stumbled on this one.
Will try it ASAP and keep you informed. :slight_smile:


EDIT just tried it and works perfectly. FWIW, I join mine (in txt format, which needs reformating ; the HTML version is much better but I can’t upload it : it is rejected by the forum as ‘possible attack vector’…

Can’t keeps me from thinking that such a tool should have been integrated in Cubase since all these years.

Thanks again ! :smiley:
Key Commands 2.txt (12.8 KB)

Moved the original VB Script to this thread to make the first post easier to read


' TODO: Set the different Const and Arrays to your needs 
' --------------------------------------------------- 
Option Explicit 
Const HTML = True ' True html file, False texte file (Tab delimited) 
Const SECTIONNAME = False ' add the section name (True or False) 
Const SORTKEY = False ' sort by key name (True or False) 
' TODO : to have your keys in a certain order, enter them here: 
'----------------------------------------------- 
B = Array( _ 
    "F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12", _ 
    "`","1","2","3","4","5","6","7","8","9","0", _ 
    "-","=","_","+","Backspace", _ 
    "A","B","C","D","E","F","G","H","I","J","K","L", "M", _ 
    "N","O","P","Q","R","S","T","U","V","W","X","Y","Z", _ 
    "[", "]","\",";","'",",",".","/","Return","Space", _ 
    "Insert", "Del", "Home", "End", "PgUp", "PgDown",  _ 
    "Left Arrow", "Up Arrow", "Right Arrow", "Down Arrow", _ 
    "Pad0","Pad1","Pad2","Pad3","Pad4","Pad5","Pad6","Pad7", _ 
    "Pad8","Pad9","Pad .","Pad /","Pad *","Pad -","Pad +","Enter" _ 
    ) ' end of array 
  ' Make sure you have SORTKEY = False ;) 
  Const REMOVE_UNUSED = False ' removes unused keys from the list 
  ' Find Replace key name , add always by pair: "SX key name", "New Name" 
  C = Array("_", "Shift+-", "+", "Shift+=") 
  ' C = Array(-1) ' uncomment if you don't want key renaming 
  ' Section color (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/colors/colors.asp) 
  ' Each section name must be followed by a color name 
BK = Array( "AddTrack",         "white", _ 
            "Analyze",          "gold", _ 
            "Arranger",         "gold", _ 
            "Audio",            "white", _ 
            "Audio Export",     "white", _ 
            "Audio Realtime Processing",   "white", _ 
            "Automation",       "white", _ 
            "Beat Designer",    "white", _ 
            "Chords",           "white", _ 
            "Control Room",     "white", _ 
            "Devices",          "white", _ 
            "Edit",             "crimson", _ 
            "Editors",          "MediumVioletRed", _ 
            "Export",           "deeppink", _ 
            "File",             "indianred", _ 
            "Focus",            "white", _ 
            "Hitpoints",        "Teal", _ 
            "Hub",              "white", _ 
            "Import",           "limegreen", _ 
            "Inspector",        "white", _ 
            "Media",            "DarkTurquoise", _ 
            "MIDI",             "turquoise", _ 
            "Mixer",            "linen", _ 
            "Navigate",         "peachpuff", _ 
            "Note Expression",  "white", _ 
            "Nudge",            "PeachPuff", _ 
            "Preferences",      "silver", _ 
            "Preset",           "white", _ 
            "Process",          "lightskyblue", _ 
            "Process Logical Preset",  "white",_ 
            "Process Plugin",   "mediumturquoise", _ 
            "Process Project Logical Editor",  "white",_ 
            "Project",          "GreenYellow", _ 
            "Quantize Category", "steelblue", _ 
            "Sample Editor",    "white", _ 
            "Score Align Elements",  "white",_ 
            "Score Functions",  "white", _ 
            "Score Meter Scale", "white", _ 
            "Score Symbol Palettes", "white", _ 
            "Scores",            "white", _ 
            "Scores Statusbar",  "white", _ 
            "Set Insert Length", "skyblue", _ 
            "Tool",              "Thistle", _ 
            "Transport",         "yellow", _ 
            "Windows",          "white", _ 
            "Workspaces",        "tan", _ 
            "Zoom",              "beige", _ 
            "Macro",             "MediumOrchid" _ 
)
			CH = Array("auml" ,228,"ouml" ,246,"uuml" ,252,"szlig" ,223,"Auml" ,196,"Ouml" ,214,"Uuml" ,220,"nbsp" ,160,"Agrave" ,192,"Egrave" ,200,"Eacute" ,201,"Ecirc" ,202,"egrave" ,232,"eacute" ,233,"ecirc" ,234,"agrave" ,224,"iuml" ,239,"ugrave" ,249,"ucirc" ,251,"uuml" ,252,"ccedil" ,231,"AElig" ,198,"aelig" ,330, "OElig" ,338,"oelig" ,339,"euro" ,8364,"laquo" ,171,"raquo" ,187, "sect", 167) 
' / TODO 
'--------------------------------------------------- 
Dim A, B, C, BK, CH 
GetSX_Keys 
Sub GetSX_Keys 
  Dim WshShell, fso, f, f2, f3, dir, dir2, tp, bc, n 
  Redim A(UBound(B)+1) 
  For f = 0 To UBound(B) 
    A(f+1) = Array( B(f), ".", ".", ".", ".", ".", ".", ".", ".") 
  Next 
  A(0) = Array("key", "-", "Shift", "Ctrl", "Alt", "Ctrl+Shift", "Alt+Shift", "Ctrl+Alt", "Ctrl+Alt+Shift")
  If HTML Then tp = "html" else tp = "txt" 
  set WshShell = CreateObject("WScript.Shell") 
  dir = WshShell.SpecialFolders("AppData") & "\Steinberg\Cubase 7_64\" 
  Set fso = CreateObject("Scripting.FileSystemObject") 
  Set f = fso.CreateTextFile(dir & "Key Commands 2." & tp, True) 
  Set f2 = fso.CreateTextFile(dir & "KC_TMP.xml", True) 
  Set f3 = fso.OpenTextFile(dir & "Key Commands.xml", 1) 

  dim xmlDoc, t, u, v, w, x, y, z, s, d 
  set xmlDoc = CreateObject("Microsoft.XMLDOM") 
  dir2 = replace(dir , "\", "/")  
  xmlDoc.validateOnParse = False 
  xmlDoc.resolveExternals = False 
  xmlDoc.async = False 

  ' special foreign chars    
  f2.write "<!DOCTYPE characters [ <!ELEMENT characters (character*) > <!ELEMENT character (#PCDATA ) > " 
  For n = 0 To UBound(CH) 
   f2.Write "<!ENTITY " & CH(n) & " " & chr(34) & "&#" & CH(n+1) & ";" & chr(34) & " >" 
   n = n+1 
  Next    
  f2.write "] > " 
  f2.write vbCRLF 
  f2.write(f3.ReadAll()) 
  f2.Close 
  f3.Close 
  xmlDoc.load(dir2 & "KC_TMP.xml") 
  If xmlDoc.parseError.errorCode Then 
    MsgBox _ 
    "File: " & dir & "Key Commands.xml" &vbCrLf & _ 
    "Line : " & xmlDoc.parseError.line & vbCrLf & _ 
    "Error: " & xmlDoc.parseError.reason, 0, "XML parser error:" 
'     Exit Sub 
  End If  
  On error resume next 
  for each t in xmlDoc.childNodes 
    If s = "Macro" Then Exit For 
    for each u in t.childNodes 
      If s = "Macro" Then Exit For 
      for each v in u.childNodes 
        If s = "Macro" Then Exit For 
        for each w in v.childNodes 
          If w.nodename = "string" Then s = w.attributes.item(1).text 
          If s = "Process Plugin" Then bc = True Else bc = False 
          If s = "Macros" Then Exit For 
          for each x in w.childNodes 
            If x.childNodes.length = 2 Then 
              d = x.childNodes.item(0).attributes.item(1).text 
              If bc Then 
                If len(d) > 34 Then d = Mid(d, 35) 
              End If  
              If x.childNodes.item(1).childNodes.length > 1 Then 
                for each y in x.childnodes.item(1).childNodes 
                  AddKey s, d , y.attributes.item(0).text 
                next 
              Else  
                AddKey s, d , x.childNodes.item(1).attributes.item(1).text 
              End If 
            End If 
          next 
        next  
      next 
    next  
  next 
  If HTML then 
    f.write "<TABLE cellSpacing=1 cellPadding=1 width=" & _ 
     chr(34) & "99%" & chr(34) & "align=center border=1>" & vbCrLf 
  End If 
  If SORTKEY Then 
    For t = 1 To UBound(A) 
      For u = t+1 To UBound(A) 
       If UCase(A(u)(0)) < UCase(A(t)(0)) Then 
         z = A(t) : A(t) = A(u) : A(u) = z 
       End If 
     Next  
    Next 
  End If  
  For t = 0 To UBound(A) 
    If HTML Then f.write "<TR>" 
    If REMOVE_UNUSED Then 
      For B = 1 To UBound(A(t)) 
        If A(t)(B) <> "." Then Exit For        
      Next 
      If B > UBound(A(t)) Then 
        Redim b(-1) : A(t) = b 
      End If  
    End If 
    For u = 0 To UBound(A(t)) 
      If HTML Then 
        If t = 0 Or u = 0 Then 
          f.write "<TD align=middle style=" & chr(34) & "FONT-WEIGHT: bold" & Chr(34) & ">" & A(t)(u) & "</TD>" 
        Else 
          If A(t)(u) = "." Then 
            'f.write "<TD align=middle>" & A(t)(u) & "</TD>" 
            f.write "<TD align=middle>.</TD>" 
          Else  
            f.write "<TD align=middle style=" & chr(34) & "BACKGROUND-COLOR: " & A(t)(u) & "</TD>" 
          End If  
        End If  
      Else 
        f.write A(t)(u) 
        If u <> UBound(A(t)) Then f.write vbTab 
      End If 
    Next 
    If HTML Then f.write "</TR>" 
    f.write vbCrLf 
  Next 
  If HTML then f.write "</TABLE>" & vbCrLf 
  f.close 
  If HTML Then s = "Explorer.exe " Else s = "notepad.exe " 
  WshShell.Run s & dir & "Key Commands 2." & tp 
End Sub 
Sub AddKey(s, d, byval k) 
  dim bp, ak, n, kn, bkc, m, ks 
  k = Trim(k) 
  If IsArray(C) Then 
    For n = 0 To UBound(C) Step 2 
      If C(n) = k Then 
        k = C(n+1) 
        Exit for 
      End If  
    Next 
  End If 
  ks = k 
  If Right(k, 1) = "+" Then bp = True 
  k = Replace(k, "+", vbCr) 
  If bp Then k = Left(k, len(k)-1) & "+" 
  ak = Split(k, vbCr) : kn = 0 
  For n = 0 To UBound(ak)-1 
    Select Case UCase(ak(n)) 
      Case "SHIFT" 
        kn = kn Or 1 
      Case "CTRL" 
        kn = kn Or 2 
      Case "ALT" 
        kn = kn Or 4 
    End Select 
  Next 
  For n = 1 To UBound(A) 
    If UCase(A(n)(0)) = UCase(ak(UBound(ak))) Then Exit For 
  Next 
  If n > UBOund(A) Then 
    Redim Preserve A(n) 
    A(n) = Array(ak(UBound(ak)), ".", ".", ".", ".", ".", ".", ".", ".") 
  End If 
  Select Case kn 
    Case 4: 
      kn = 3 
    Case 3: 
      kn = 4 
  End Select 
  If HTML Then 
    bkc = "white" 
    If IsArray(BK) Then 
      For m = 0 To UBound(BK) Step 2 
        If BK(m) = s Then 
          bkc = BK(m+1) 
          Exit For 
        End If 
      Next 
    End If 
  End If  
  If SECTIONNAME Then 
    A(n)(kn+1) = bkc &  A(0)(kn) & ">" & s & "-" & d 
  Else 
    A(n)(kn+1) = bkc & chr(34) & " title=" & chr(34) & "[ " & s & " ]  " & ks & "  : " & d & chr(34) & ">" & d 
  End If 
End Sub

EDIT: If you are using the 32 bit C7, you have to edit the line that starts with dir = WshShell and remove _64.

It still seems to work with C7. So just create a RandomName.vbs file in your \Users\AppData\Roaming\Steinberg\Cubase7(_64)\ directory.

Copy the following code into the vbs file. You can edit it with any text editor. You can mess with the colors for the type of command and there are options for dealing with some non-US character sets. Once you copy the code into the file, save it … double click the file and an html file should pop up with your key commands laid out by accelerator.

FWIW, and as I’m not allowed by the forum to upload the HTML file generated for security reasons, I just imported it in Libre Office Writer 3.6 and exported it again as it is in a PDF format.

The result is joined. Quite usable and much better than what I was doing until now : a tedious editing work on a copy of the xml file which needed to be done again, each time I changed a key command for a reason.

The HTML file is the best, though : all the key commands are displayed in less than two screens, here.
Key Commands 2.pdf (97.7 KB)

Updated the script in the first post. See the EDIT statement at the top to see what/why. You can grab the new code and just overwrite what you have if you want. Or, you can just copy the BK = Array section to get just the main part I changed.

Updated to hopefully fix it so the macros show up. It’s possible I screwed something else up while fixing that loop. So, be attentive.

If you would like to see the colors you can choose from.
colors

Thanks I’m going to try this today

Coolness! The macros at least show up. I’ve not seen any misbehavior yet, so for now it’s working … :sunglasses:

Thank you very much!

I’ve just test the vbs, the html generated fine… I am testing it with Cubase 6, but this should not be an issue.

However the modifiers are wrong - e.g one of my shortcut works with the Alt modifier, but this is tabulated to the Shift column…all other keycommands are also assigned to a wrong modifier.

Any idea?

US keyboard?
Interesting, can you pm me the key commands.xml file?

Never mind, I think I figured it out. He didn’t make it so that it sorted by modifier and I moved them to my preferred order. I wrote a similar utility in C#, but it lets you set the modifier order. I had assumed this would as well.

Anyhow, I put it back in his fixed order. So, the command will stay in the same place, but the column header will be different.

You can just fix this one line if you want. It should be as follows…

A(0) = Array("key", "-", "Shift", "Ctrl", "Alt", "Ctrl+Shift", "Alt+Shift", "Ctrl+Alt", "Ctrl+Alt+Shift")

Thanks you very much, I am using a UK layout keyboard, now works great here! :smiley:

This is excellent. Much easier to get a handle on the key commands

I built a spreadsheet and wrote a parser to import it into excel back in the SX days. The first time I saw the results laid out this way, it was such a huge eye opener. I was able to optimize so many aspects of the keymap that I didn’t even know were screwed up. It also lets you see the huge gap of unused keys. It’s just such a great way to see what’s going on.

Thanks for this.
Incredibly handy…

This should be a sticky.

Is there any way to list unassigned keycommands as well in order to browse what I maybe miss ? :slight_smile:

For me is would perfectly fine to list them into a separate html file.

JMCecil,

I’m on Mac, and want to have this too. I run a Virtual Box install of windows xp and have succeeded in creating an html file from my key commands xml file by editing a few lines in the .vbs file.

The problem is that there is one more modifier key available on Mac than on PC, so I need to create more columns, which I was able to do, and parse the corresponding commands into them, which I was not.

I fiddled with the array statements, but don’t have enough Basic knowledge to make this happen. I was hoping I am missing something that would help me.

Anywho, PM me if this is too much for a forum post, and thanks for your work on the original.

yeah, its tough because the variable and array setup he has is more the “geterdone” variety. Very hard to follow. I tried re-ordering the columns and failed miserably. But, I think the code you are looking for is in the case statements where he sets “kn” values for parsing in the loops.

Thanks. I’ll have another go at it.

@SteveInChicago, did you ever get it working on mac?