It was pretty easy to get this far:

var current_file=document.FullName;
var with_out_ext=current_file.substring(0, current_file.lastIndexOf(“.”));
var ext=current_file.substring(current_file.lastIndexOf(“.”));
switch (ext)
case “.cpp”: ext = “.h”; break;
case “.h”: ext = “.cpp”; break;
editor.OpenFile(with_out_ext+ext, 0, eeOpenAllowNewWindow);

But I haven’t found where to get the list of extensions from the current configuration. I’m also not sure how to test if the file exists (so I can try the next file extension if it does not exist).

Tips/suggestions welcome.