Script examples(Ver1.90対応版)
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
js:open("C:\\folder");
js: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
js: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);
	  }
	


Execute program
c:\windows\notepad.exe c:\folder\test.txt

js:createObject("WScript.Shell").run('notepad.exe c:\\folder\\test.txt');

js:createObject("Shell.Application").ShellExecute('notepad.exe', 'c:\\folder\\test.txt');

js:createObject("WScript.Shell").run('"'+fullName+'" /i');

js:createObject("Shell.Application").ShellExecute('"'+fullName+'"', '/i');

プログラム実行の例


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

test.jsの内容
	  //test.js
	  var iItem=getNextItem(-1,2);
	  if(iItem<0){
	    message("選択がありません");
	  } else {
	    var objShell = createObject("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 = createObject("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 = createObject("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 = createObject("Scripting.FileSystemObject");
	    var strPath = getItemPath(iItem);
	    var strExt = obj.GetExtensionName( strPath );
	    open("*." + strExt);
	    obj = null;
	  }
	


Use any object
createObjectでオブジェクトを作成できます。
(V1.86未満では、JScriptにおいてはnew ActiveXObjectにする必要があります)

js:C:\folder\test.js

test.jsの内容
	  //test.js
	  var objFSO = createObject("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 = createObject("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;