2011/12/11 (日) 16:19:51  
[544] 選択行コメントアウトの勝手に改良版

var aExt = new Array();

aExt[""] = "//"; //デフォルト

aExt["c"] = "//";   aExt["cpp"] = "//"; aExt["h"] = "//";
aExt["js"] = "//";  aExt["java"] = "//";
aExt["vbs"] = "'";  aExt["bas"] = "'";  aExt["frm"] = "'";  aExt["cls"] = "'";
aExt["mac"] = "//";
aExt["pl"] = "#";   aExt["pm"] = "#";   aExt["cgi"] = "#";
aExt["tex"] = "%";
aExt["php"] = "//";
aExt["asm"] = ";";
aExt["uws"] = "//";
aExt["conf"] = ";"; aExt["cnf"] = ";";  aExt["ini"] = ";";  aExt["inf"] = ";";
aExt["ppa"] = "//";
aExt["cmd"] = "rem ";    aExt["bat"] = "rem ";
aExt["sql"] = "--";
 
//行選択されていなくても
GoLineTop(13);
sSelect = GetSelectedString(0);
if (sSelect.length == 0) GoLineEnd_Sel();

sSelect = GetSelectedString(0);
 
//拡張子を切り出し
sExt = ExpandParameter("$f");
sExt = sExt.substring( sExt.lastIndexOf(".") + 1);
sExt = sExt.toLowerCase()

if(aExt[sExt] == null){
        sExt = "";
}
 
//選択範囲を置換
if(sSelect.substring(0, aExt[sExt].length) == aExt[sExt]){
        //コメント解除用
        ReplaceAll ("^([    \s]*)" + aExt[sExt], "$1", 148);
}
else{
        //コメントアウト用
        ReplaceAll ("^.", aExt[sExt] + "$&", 148);
}

//正規表現検索を無理やり解除
ReplaceAll ("@@@@@@@@@@", "@@@@@@@@@@", 146);

CancelMode();
SearchClearMark();
ReDraw(0);
beta
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

[▼次のスレッド]
INCM/CMT
Cyclamen v3.81