Welcome, guest | Sign In | My Account | Store | Cart

The project/file API changed significantly moving from Komodo 5 to 6. Specifically, the project manager and file manager have been split into two separate modules.

Here's some code to duplicate the current file, using Komodo 6. Note that it uses an internal function - I've made a note that the function has been effectively published, and needs to preserve its current interface.

JavaScript, 15 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
try {
    var viewMgr = ko.places.viewMgr;
    var uris = viewMgr.getSelectedURIs();
    if (uris.length != 1) {
        throw new Error("Can only copy one file at a time\n");
    }
    var idx = viewMgr.view.getRowIndexForURI(uris[0]);
    var parentIdx = viewMgr.view.getParentIndex(idx);
    var target_uri = (parentIdx == -1
                      ? ko.places.manager.currentPlace
                      : ko.places.viewMgr.view.getURIForRow(parentIdx));
    viewMgr._finishFileCopyOperation(uris, target_uri, parentIdx, true);
} catch(ex) {
    ko.dialogs.alert("Error in copy-current-file macro", ex.message)
}
Created by Eric Promislow on Thu, 3 Feb 2011 (MIT)
JavaScript recipes (69)
Eric Promislow's recipes (11)

Required Modules

  • (none specified)

Other Information and Tasks