* 相対パスを開く [#t20d7ffe]
-ページ: [[Macro/投稿]]
-作者: [[di]]
-カテゴリー: js
-投稿日: 2006-06-06 (火) 12:54:11
** メッセージ [#m926d5bf]
#code(javascript){{
//SakuraOpenner.js
var oFS = new ActiveXObject("Scripting.FileSystemObject");
var oShell = new ActiveXObject("WScript.Shell");
// 選択文字列を絶対(物理)パスに変換
var sPhysPath = oFS.GetAbsolutePathName( GetSelectedString(0) );
if( oFS.FileExists( sPhysPath ) ){
//File Open
Editor.FileOpen( sPhysPath );
}else{
if( oFS.FolderExists( sPhysPath ) ){
//Folder Open
var oShellApp = new ActiveXObject("Shell.Application");
oShellApp.Open( sPhysPath );
oShellApp = null;
}else{
//Not Found
oShell.Popup("そんなファイルなっしんぐ" + "\r\n" + sPhysPath
, 0, "SakuraOpenner", 0 );
}
}
oShell = null;
oFS = null;
}}
----
#comment