{
  "keyboard_shortcut": "F5", 
  "name": "TclInit", 
  "language": "JavaScript", 
  "trigger_enabled": 0, 
  "rank": 100, 
  "trigger": "trigger_postopen", 
  "value": [
    "//", 
    "// Last Modified: 2012-06-18", 
    "// Last Modified By: Alex Hisen", 
    "// Original Author:  Alex Hisen", 
    "//", 
    "// Bind this macro to the key F5, which can then be used", 
    "// to TclInit an open tcl file from a shared or private library", 
    "// from the X:\\<PROJECT> DFS tree by launching the appropriate", 
    "// /NS/TclInit url in the default browser", 
    "", 
    "komodo.assertMacroVersion(3);", 
    "if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focus(); }", 
    "", 
    "function TclInit () {", 
    "    var document = komodo.view.koDoc || komodo.view.document; ", 
    "    var file = document.displayPath;", 
    "    file = file.split('\\\\');", 
    "    var drive = file.shift();", 
    "    if (drive.toLowerCase() != \"x:\") {", 
    "        alert(\"Only X: (i.e. DFS tree) paths are supported, not \" + drive);", 
    "        return;", 
    "    }", 
    "    ", 
    "    var project = file.shift();", 
    "    var library = file.shift().toLowerCase();", 
    "    ", 
    "    if (library != \"private\" && library != \"shared\") {", 
    "        alert(\"Only private and shared subprojects can be TclInit-ed\");", 
    "        return;", 
    "    }", 
    "", 
    "    file.unshift(library);", 
    "    file = file.join('/');", 
    "", 
    "    // ADD CASES FOR OTHER PROJECTS HERE (use all UPPERCASE project names)", 
    "    // (make sure url produced includes a ?)", 
    "    switch (project.toUpperCase()) {", 
    "        case \"AM\":", 
    "            var url = 'http://192.168.150.100/NS/TclInit/' + file + '?forward=192.168.150.200';", 
    "            break;", 
    "        case \"DNCSCRUB\":", 
    "            var url = 'http://dev1.dncscrub.com/NS/TclInit' + file + '?forward=dev2.dncscrub.com';", 
    "            break;", 
    "        case \"METALINQ\":", 
    "            var url = 'http://www1.metalinq.com/NS/TclInit/' + file +'?forward=www2.metalinq.com';", 
    "            break;", 
    "    }", 
    "    ", 
    "    if (url) {", 
    "        var rand = Math.random();", 
    "        url = url + '&rand=' + rand", 
    "        //alert(url);", 
    "        ko.browse.openUrlInDefaultBrowser(url);", 
    "    }", 
    "}", 
    "", 
    "TclInit();"
  ], 
  "version": "1.0.7", 
  "async": 0, 
  "type": "macro"
}