Script examples(Ver1.50対応版)
Index



Select all and copy
js:SelectAll();Copy();


Execute command by command name
js:Command("タブの分割方向切り替え");
js:Command("New Tab");


Sort by property name
(「SVN リビジョン」というカラムがある場合)
js:Sort("SVN リビジョン",1);
js:Sort("Attributes",1);


Open specify folder
(JScriptの場合)
js:Open("C:\\folder");
(VBScriptの場合)
vbs:Open "C:\folder"
(JScript)
js:Open("C:\\folder");
(VBScript)
vbs:Open "C:\folder"


Open folder and set view and sort
js:Open("C:\\folder");SetView(1);Sort("name",1);


Open folder and set view and sort (case 2)
js:Open("C:\\folder");SetView(2);Sort("date",2);


Open multiple folder
vbs:CloseOtherTab:Open "C:\folder1":Open "C:\folder2",1


Filter
js:Open("*.jpg;*.gif");


Clear filter
js:Open("");


Change settings by config object
js:Config.CheckBox = !Config.CheckBox;


Copy item path to clipboard
js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var s="";
	  var iItem=GetNextItem(-1,2);
	  if(iItem<0){
	    Message("選択がありません");
	  }else{
	    while( iItem >= 0 ) {
	      s=s+GetItemPath(iItem)+"\r\n";
	      iItem=GetNextItem(iItem,2);
	    }
	    SetClipboard(s);
	  }
	
js:C:\folder\test.js

test.js
	  //test.js
	  var s="";
	  var iItem=GetNextItem(-1,2);
	  if(iItem<0){
	    Message("There is no selection");
	  }else{
	    while( iItem >= 0 ) {
	      s=s+GetItemPath(iItem)+"\r\n";
	      iItem=GetNextItem(iItem,2);
	    }
	    SetClipboard(s);
	  }
	


Copy display name to clipboard
js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var s="";
	  var iItem=GetNextItem(-1,2);
	  if(iItem<0){
	    Message("選択がありません");
	  }else{
	    while( iItem >= 0 ) {
	      s=s+GetItemText(iItem)+"\r\n";
	      iItem=GetNextItem(iItem,2);
	    }
	    SetClipboard(s);
	  }
	
js:C:\folder\test.js

test.js
	  //test.js
	  var s="";
	  var iItem=GetNextItem(-1,2);
	  if(iItem<0){
	    Message("There is no selection");
	  }else{
	    while( iItem >= 0 ) {
	      s=s+GetItemText(iItem)+"\r\n";
	      iItem=GetNextItem(iItem,2);
	    }
	    SetClipboard(s);
	  }
	


Open by notepad
js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var iItem=GetNextItem(-1,2);
	  if(iItem<0){
	    Message("選択がありません");
	  } else {
	    var objShell = new ActiveXObject("WScript.Shell");
	    objShell.Run( "notepad.exe " + GetItemPath(iItem) );
	    objShell = null;
	  }
	
js:C:\folder\test.js

test.js
	  //test.js
	  var iItem=GetNextItem(-1,2);
	  if(iItem<0){
	    Message("There is no selection");
	  } else {
	    var objShell = new ActiveXObject("WScript.Shell");
	    objShell.Run( "notepad.exe " + GetItemPath(iItem) );
	    objShell = null;
	  }
	


Copy details view by TSV to clipboard
js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var s="";
	  var cItem=GetItemCount();
	  var cCol=GetColumnCount();
	  for(iCol=0;iCol<cCol;iCol++){
	    s=s+GetColumnText(iCol);
	    if(iCol<cCol-1)s=s+"\t";
	  }
	  s=s+"\r\n";
	  for(iItem=0;iItem<cItem;iItem++){
	    for(iCol=0;iCol<cCol;iCol++){
	      s=s+GetItemText(iItem,iCol);
	      if(iCol<cCol-1)s=s+"\t";
	    }
	    s=s+"\r\n";
	  }
	  SetClipboard(s);
	
js:C:\folder\test.js

test.js
	  //test.js
	  var s="";
	  var cItem=GetItemCount();
	  var cCol=GetColumnCount();
	  for(iCol=0;iCol<cCol;iCol++){
	    s=s+GetColumnText(iCol);
	    if(iCol<cCol-1)s=s+"\t";
	  }
	  s=s+"\r\n";
	  for(iItem=0;iItem<cItem;iItem++){
	    for(iCol=0;iCol<cCol;iCol++){
	      s=s+GetItemText(iItem,iCol);
	      if(iCol<cCol-1)s=s+"\t";
	    }
	    s=s+"\r\n";
	  }
	  SetClipboard(s);
	


Filter by selected item extension
js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var iItem=GetNextItem(-1,1);
	  if(iItem>=0){
	    var obj = new ActiveXObject("Scripting.FileSystemObject");
	    var strPath = GetItemPath(iItem);
	    var strExt = obj.GetExtensionName( strPath );
	    Open("*." + strExt);
	    obj = null;
	  }
	
js:C:\folder\test.js

test.js
	  //test.js
	  var iItem=GetNextItem(-1,1);
	  if(iItem>=0){
	    var obj = new ActiveXObject("Scripting.FileSystemObject");
	    var strPath = GetItemPath(iItem);
	    var strExt = obj.GetExtensionName( strPath );
	    Open("*." + strExt);
	    obj = null;
	  }
	


Use any object (VBS)
WScript.CreateObjectは使えませんが、グローバルなCreateObjectは使えます。
WScript.Echoは使えませんが、VBScriptのMsgBoxは使えます。

vbs:C:\folder\test.vbs

test.vbsの内容
	  'test.vbs
	  Set objFSO = CreateObject("Scripting.FileSystemObject")
	  strPath = "C:\folder\file.txt"
	  MsgBox strPath & vbCrLf _
	    & objFSO.GetDriveName(strPath) & vbCrLf _
	    & objFSO.GetFileName(strPath) & vbCrLf _
	    & objFSO.GetBaseName(strPath) & vbCrLf _
	    & objFSO.GetExtensionName(strPath) & vbCrLf _
	    & objFSO.GetParentFolderName(strPath) 
	  Set objFSO = Nothing
	
vbs:C:\folder\test.vbs

test.vbs
	  'test.vbs
	  Set objFSO = CreateObject("Scripting.FileSystemObject")
	  strPath = "C:\folder\file.txt"
	  MsgBox strPath & vbCrLf _
	    & objFSO.GetDriveName(strPath) & vbCrLf _
	    & objFSO.GetFileName(strPath) & vbCrLf _
	    & objFSO.GetBaseName(strPath) & vbCrLf _
	    & objFSO.GetExtensionName(strPath) & vbCrLf _
	    & objFSO.GetParentFolderName(strPath) 
	  Set objFSO = Nothing
	


Use any object(JScript)
WScript.CreateObjectは使えませんが、new ActiveXObjectは使えます。
WScript.Echoは使えませんが、秀丸ファイラー固有のMessageメソッドは使えます。

js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var objFSO = new ActiveXObject("Scripting.FileSystemObject");
	  strPath = "C:\\folder\\file.txt";
	  Message( strPath + "\n"
	    + objFSO.GetDriveName(strPath) + "\n"
	    + objFSO.GetFileName(strPath) + "\n"
	    + objFSO.GetBaseName(strPath) + "\n"
	    + objFSO.GetExtensionName(strPath) + "\n"
	    + objFSO.GetParentFolderName(strPath) );
	  objFSO = null;
	
js:C:\folder\test.js

test.js
	  //test.js
	  var objFSO = new ActiveXObject("Scripting.FileSystemObject");
	  strPath = "C:\\folder\\file.txt";
	  Message( strPath + "\n"
	    + objFSO.GetDriveName(strPath) + "\n"
	    + objFSO.GetFileName(strPath) + "\n"
	    + objFSO.GetBaseName(strPath) + "\n"
	    + objFSO.GetExtensionName(strPath) + "\n"
	    + objFSO.GetParentFolderName(strPath) );
	  objFSO = null;