Skip navigation
Currently Being Moderated

Importing CS4 Keyboard Shortcuts to CS5

Jun 9, 2010 12:40 PM

I've  discovered that you can open your custom keyboard shortcuts xml file in a  text editor, and copy/paste shortcuts into your CS5 keyboard shortcuts  file. Anyone else tried this? Is there an easier way to import all of  your keyboard shortcuts from CS4 to CS5?

 
Replies
  • Currently Being Moderated
    Jun 9, 2010 1:38 PM   in reply to mattmayerchak

    I'll be interested to know if this works long-term. There have been a few reported problems with simply trying to copy the shortcut file and paste it into your user profile for the new version.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 9, 2010 2:03 PM   in reply to mattmayerchak

    That's very interesting, and potentially a very clever solution. I'd bet it would be enough, if this works, to simply open the CS4 set, change the version and build numbers, and resave in the CS5 folder.

     

    Is there anything different at the end of the files?

     

    One thing I can think of that might throw a kink into this is that CS5 has some new tools and behaviors whcih would not be present in the CS4 file, so maybe the copy paste for the particualr shorcuts is a better plan.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 9, 2010 2:27 PM   in reply to mattmayerchak

    Please do come back after working for a week or so and let us know if any odd stuff starts to happen. I can't remember the exact symptoms of tying to use an old shorcut set, but it seems like it was stuff just not behaving properly.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 11, 2010 4:53 AM   in reply to mattmayerchak

    This popped up this morning: http://forums.adobe.com/message/2886886#2886886

     

    I'm pretty sure that's typical of the sort of problem people were reporting when trying to use CS4 shortcuts, so let us know.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 9:52 AM   in reply to Peter Spier

    This is really insane...so i have to tediously write one by one of all my personal keyboard shortcuts again when upgrading to CS5? Haven't the people at Adobe never thought of that? quite basic stuff by the way.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 10:10 AM   in reply to SebastiaoV

    You should make a feature request to Adobe. My hunch is that the vast majority of InDesign users don't define a large number of keyboard shortcuts so it's probably not a widely desired feature. (But I could be wrong... Those who disagree can reply in this thread.)

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Aug 6, 2011 10:15 AM   in reply to SebastiaoV

    SebastiaoV wrote:

     

    This is really insane...so i have to tediously write one by one of all my personal keyboard shortcuts again when upgrading to CS5?

    Huh? No, not at all.

    Just copy the entire keyboard shortcuts file from the CS4 directory to the CS5 directory.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 10:23 AM   in reply to John Hawkinson

    thanks for the fast reply guys,

     

    @John

    From what i am reading up in the forum if you just copy copy directly the .xml shortcut file from CS4 preset folder to CS5 you most likely mess up the keys. There are some new tools that might not work properly.

     

    @Steve

    Good idea, i will make the request. I do like to make my own shortcuts at least the ones that i use quite frequently. I find some default commands to be way too complex for a simple action. By the way, there are also some shortcuts that are thought in mind with the English Standard keyboard with brackets and so for which are not easy to reach in a Spanish keyboard (i bet is the same situation in many languages different from English too).

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 10:26 AM   in reply to John Hawkinson

    Bad idea, John. While it may work, it may totally screw up InDesign.

     

    I would advise against it based on past information posted by others in this forum.

     

    Bob

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Aug 6, 2011 10:27 AM   in reply to SebastiaoV

    My experience is that it basically works fine, though it's been a while.

     

    But yes, if you want to be sure, use a tool to compare the differences

    between the default shortcuts in CS4 and your own shortcuts, then take

    those differences, and paste them into a copy of the CS5 shortcuts

    file.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Aug 6, 2011 10:35 AM   in reply to Bob Levine

    The potential damage is pretty limited, Bob. It's note like missing

    a few keyboard shortcuts will cause InDesign to corrupt your documents.

    The worst case is essentially that it doesn't work, and the more likely

    case that a few shortcuts don't work. If that's the cae, then just

    remove the file.

     

    I certainly agree Adobe should make this more user-friendly, but it's

    not the sort of thing that's dangerous to experiment with.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 10:39 AM   in reply to John Hawkinson

    My recollection is that users who tried this ran into significant problems (don't recall what they were) and they were NOT easily fixed by editing the file.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 10:50 AM   in reply to Peter Spier

    My memory is the same as Peter's and Bob's. It can cause subtle problems which don't necessarily show up immediately and which become hard to fix.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 10:52 AM   in reply to John Hawkinson

    John, I think you're going to have to take the word of those of us who've been around for a while. I've read some pretty ugly descriptions of problems.

     

    Of course, as I've said before, I'll be more than happy to let you assist those who don't want my advice.

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2011 12:43 PM   in reply to Bob Levine

    Hi,

     

    I started this thread (but my username has changed). It's been awhile since I did this but as I recall, I didn't import my ENTIRE keyboard shortcut set - I opened the XML file from CS4 and copied the shortcuts I wanted into the CS5 file. A lot of them all at once. And, it's been working fine since then.

     

    So, I wouldn't just replace the entire CS5 set with the CS4 file - obviously you would lose all of the new CS5 feature shortcuts. I was just looking for a quicker way to import my own custom CS4 shortcuts into the CS5 file and that worked.

     

    I hope that clears things up a little.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Aug 7, 2011 9:13 PM   in reply to Mayerchak

    I did some experimentation, and I stand corrected! Apparently my memory was dodgy. In particular:

     

    My experience is that it basically works fine, though it's been a while.

     

    I thought we had tested this from CS3 to CS5, but it looks like maybe we only did it from CS5 to CS5.5. Which are a lot more similar.

    (And yes, I did recall people having complaints about it, but my experience disagreed...)

     

    Indeed, you have some problems with CS4 to CS5, but they are not subtle. At least, initially, I was getting a dialog box informing me that there were defined shortcuts in the shortcut set that were invalid (Somewhere along the way that stopped happening, which is Interesting, but probably not relevant).

     

    Anyhow, I certainly don't disagree that pasting the XML differences is the better way to go -- I said as much in post #13.

    But by way of recompense, here are a pair of scripts to make it easier.

     

    Both require you to create a special shortcut set called "defaults" (i.e. defaults.indk) that they use as a baseline for differences. For a variety of reasons, it is insufficient for the script to use the Default.indk file in the application directory. Both scripts pop up an error if you have not done this, and tell you how to do it.

     

    The first one, extractShortcuts.jsx, prompts you to select a shortcut file to extract from, compares it against the default shortcut set, and outputs and differences to a file on the Desktop, extracted.xml. Run this in CS4.

     

    The second one, importShortcuts.jsx, prompts you to select the extracted.xml file from previous, asks you for the name of the new shortcut set, and then merges the two. It merges them in a fairly stupid way (just plain appending just before the end), but it's probably sufficient.

     

    So here we go, exportShortcuts.jsx:

    #target InDesign
     
    (function() {
         var appdir = app.filePath,
              prefs, shortcuts,
              i, s,
              defaults, readcuts,
              defxml, readxml,
              e, ea, action, context, string,
              defaultsByAction, d;
              
         var includes = $.includePath.split(";");
     
     
         for (i=0; i<includes.length; i++) {
              s = includes[i];
              if (s.match("Preferences") && s.match(/Scripts$/)) {
                   prefs = new File(s).parent;
                   break;
                   }
              }
     
         if (!prefs) {
              alert("Could not find User Preferences directory");
              exit(1);
         }
         // $.writeln(prefs.fsName);
         shortcuts = prefs.getFiles("InDesign Shortcut Sets")[0];
         defaults = shortcuts.getFiles("defaults.indk")[0];
     
     
         if (!defaults) {
              alert(
         'The script requires a special shortcut set called "defaults" to exist.\n'+
         'The app-folder Defaults.indk is NOT sufficient. Please go to '+
         'Edit > Keyboard Shortcuts, and select the the [Default] shortcut set,'+
         '  modify it in a trivial way (for instance, assign F1 to About InDesign),'+
         ' name the new set "defaults", remove the modification, and save the set.'+
         ' Then re-run this script.');
              exit(1);
         }
     
         readcuts = shortcuts.openDlg("Select an INDK file to extract shortcuts from.","*.indk");
         writecuts = new File(Folder.desktop.fullName+"/extracted.xml");
     
         defaults.open("r");
         defxml = new XML(defaults.read());
         defaults.close();
     
         readcuts.open("r");
         readxml = new XML(readcuts.read());
         readcuts.close();
     
         writecuts.open("w");
         writecuts.writeln("<shortcut-sets>"); // hack
     
         defaultsByAction = {};
     
         for (i=0; i<defxml.shortcut.length(); i++) {
              e = defxml.shortcut[i];
              ea = e.elements()[0];
              if (ea.name() != "action-id") {
                   alert("Parse failure on element "+ea);
                   exit(1);
              }
              action = ea.attributes();
              context = e.context[0];
              string = e.string[0];
              defaultsByAction[action] = { context: context, string: string };
              }
     
         for (i=0; i<readxml.shortcut.length(); i++) {
              e = readxml.shortcut[i];
              ea = e.elements()[0];
              if (ea.name() != "action-id") {
                   alert("Parse failure on element "+ea);
                   exit(1);
              }
              action = ea.attributes();
              context = e.context[0];
              string = e.string[0];
              d = defaultsByAction[action];
              if (!d ||
                   d.context != context ||
                   d.string != string) {
                   writecuts.writeln(e);
              }
         }
     
         writecuts.writeln("</shortcut-sets>"); // matching hack
         writecuts.close();
    }());
     
    

     

    And its mating half, importShortcuts.jsx:

     

    #target InDesign
     
    (function() {
        var appdir = app.filePath,
            prefs, shortcuts,
            i, s,
            defaults, readcuts,
            writename, writecuts,
            defxml, readxml,
            e, ea, action, context, string,
            defaultsByAction, d;
            
        var includes = $.includePath.split(";");
     
     
        for (i=0; i<includes.length; i++) {
            s = includes[i];
            if (s.match("Preferences") && s.match(/Scripts$/)) {
                prefs = new File(s).parent;
                break;
                }
            }
     
        if (!prefs) {
            alert("Could not find User Preferences directory");
            exit(1);
        }
        // $.writeln(prefs.fsName);
        shortcuts = prefs.getFiles("InDesign Shortcut Sets")[0];
        defaults = shortcuts.getFiles("defaults.indk")[0];
     
     
        if (!defaults) {
            alert(
        'The script requires a special shortcut set called "defaults" to exist.\n'+
        'The app-folder Defaults.indk is NOT sufficient. Please go to '+
        'Edit > Keyboard Shortcuts, and select the the [Default] shortcut set,'+
        '  modify it in a trivial way (for instance, assign F1 to About InDesign),'+
        ' name the new set "defaults", remove the modification, and save the set.'+
        ' Then re-run this script.');
            return 1;
        }
     
        readcuts = Folder.desktop.openDlg("Select an XML file to import shortcuts from","*.xml");
     
        writename  = prompt("Choose a name for the new shortcut set. One word, no spaces, please.",
        "new");
     
        writecuts = new File(shortcuts+"/"+writename+".indk");
     
        defaults.open("r");
        defxml = new XML(defaults.read());
        defaults.close();
        
        readcuts.open("r");
        readxml = new XML(readcuts.read());
        readcuts.close();
     
        defxml.appendChild(readxml.elements());
        
        writecuts.open("w");
        writecuts.write(defxml);
        writecuts.close();
        
    })();
    

     

    These are written on a Mac. I suppose there's they might not work perfectly under Windows if the logic to find the user's keyboard shortcuts directory doesn't work.

     

    As always, install scripts by saving each script as a plain text file (in TextEdit or Notepad) and following directions at, e.g., How to Install InDesign Scripts.

    Good night.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points