ActiveState Community

Is there a way??

Posted by pmsquillace on 2009-02-27 09:29
OS: All / Any

Hello All:

Is there a way to set up KomodoEdit so that when you click on New Project or the Open File that it is set to a default Directory?

Not a huge issue but thought it would be nice to be where you keep your projects when you open it.

Thanks for any help or advice on the matter,

Paul

toddw | Fri, 2009-02-27 11:48

There is always a way :D

I've been using Dafi's MoreKomodo extension, utilizing the favourites feature, which enables you to easily setup a bunch of common open locations.

Alternatively, you could write your own macro (and override the existing open keybinding) to do whatever you wish. Here is a simple JavaScript macro example:

var defaultDir = "";
var project = ko.projects.manager.currentProject;
if (project) {
    if (project.live && project.prefset.hasPrefHere("import_dirname")) {
        defaultDir = project.prefset.getStringPref("import_dirname");
    } else {
        defaultDir = ko.uriparse.dirName(project.url);
    }
}
ko.filepicker.openFiles(defaultDir);
var defaultDir = "";
var project = ko.projects.manager.currentProject;
if (project) {
    if (project.live && project.prefset.hasPrefHere("import_dirname")) {
        defaultDir = project.prefset.getStringPref("import_dirname");
    } else {
        defaultDir = ko.uriparse.dirName(project.url);
    }
}
ko.filepicker.openFiles(defaultDir);

Also, I just noticed a new extension on the Komodo community site, which may be of interest (though I have not yet tried it out):
http://community.activestate.com/xpi/quick-open

Cheers,
Todd

pmsquillace | Fri, 2009-02-27 12:03

Hey thanks Todd,

That is a great help, at least I have a starting point.

P