Appendix K:
Modifying the Shortcut File

Changing Keyboard Shortcuts

You can change keyboard shortcuts in Dreamweaver either by using a previously unused shortcut or by reassigning an existing shortcut to a different menu item. In Chapter 19, I discuss using Dreamweaver 4's new Keyboard Shortcut Manager (Figure 1). This appendix is for people who would rather reassign keyboard shortcuts by editing the menus.xml file instead of using a dialog box.

Figure 1. Dreamweaver 4 features a new, easy-to-use Keyboard Shortcut Manager. I discuss using this dialog box in Chapter 19.

Tip

The Dreamweaver help files include a Keyboard Shortcut Matrix (Figure 2) that displays standard key combinations and the command attached, if any. The location on your computer is something like this:

Windows:

C:\PROGRAM FILES\MACROMEDIA\DREAMWEAVER 4\ Help\UsingDreamweaver\html\23AppAShortcuts26.html

Mac:

Hard Drive/Macromedia/ Dreamweaver 4/Help/ UsingDreamweaver/html/ 23AppAShortcuts26.html

Figure 2. The Keyboard Shortcut Matrix lists all existing and empty keyboard shortcuts in Dreamweaver.

You can also open the file called 23AppAShortcuts1.html, in the same folder to browse through a list of shortcuts by category. Click the arrows to move through the pages.

To change a keyboard shortcut:

  1. Quit Dreamweaver.

  2. Open your working copy (not the pristine backup) of menus.xml in your favorite non-Dreamweaver text editor.

  3. If you're adding a new keyboard shortcut that doesn't need to be reassigned, skip to step 6.

    If you need to remove references to your shortcut first, locate, in the menus.xml file, the menu command that contains the shortcut you want to use, and copy the shortcut (Ctrl+C/Cmd+C).

  4. Open the Find feature of your text editor, and paste (Ctrl+V/Cmd+V) the shortcut into the Find What text box.

  5. Find each instance of the shortcut in the menus.xml document, and delete each one. The key attribute will read key="".

  6. Find the menu item to which you want to assign the new shortcut.

    If the menu item already has a shortcut, select it and paste the shortcut over it (Figure 3).

    Figure 3. I'm changing every reference to the Properties inspector to indicate my new shortcut. By using "Cmd" instead of "Ctrl," my shortcut will work on both Windows and the Mac.

    If the menu item does not have a shortcut, you need to add the key attribute:

    key="Ctrl+Shift+P"

  7. Don't touch the ID attribute.

  8. Save your file as menus.xml in the Menus folder.

  9. Launch Dreamweaver and test the new shortcut. The menu item should also indicate the new combination (Figure 4).

    Figure 4. You can see, in the Window menu, that I changed the keyboard shortcut for displaying the Properties inspector. Note that "Cmd" shows up as "Ctrl" on the PC. On the Mac, it would be displayed as the butterfly symbol that's on the Command key.

Tip

If a shortcut is assigned to two different menu items, the first pairing listed in menus.xml will be the working combination. That means it's especially important to make the changes in the keyboard shortcuts section at the top of the menus.xml file.

Mama's Little Baby Likes Shortcuts

Some people like clicking on buttons, some people prefer to do their selecting with menus, and others like the quick convenience of keyboard shortcuts. Why would you want to be able to edit these shortcuts in Dreamweaver? I don't know about you, but I have a lot of standard keyboard shortcuts memorized, and not so many nonstandard ones. I remember that F10 opens the HTML inspector, but if I want to open any other palette or inspector, I'm pretty much wedded to the Window menu.

You can, however, change keyboard shortcuts so that they work for you. For instance, the Properties inspector didn't even get a keyboard shortcut in Dreamweaver 1.2, and I can't seem to remember Ctrl+F3. So I decided to make it more like P, for Properties. Ctrl+P is paste, and I don't want to change that. So I open the Keyboard Shortcuts editor, select Window > Properties, and then press Ctrl+Shift+P.It looks like Ctrl+Shift+P is Format: Paragraph. I don't use that shortcut, anyway. So I can go ahead and change it.