元ネタは、何年も前にどこかから拾ったもの(2chのあふスレかな? ググったけど出てこなかった)。
あふwこまんど使用。
あふwこまんどは(というか、あふw自体が)ローカルパスとUNCパスは開けるけどfile URI Scheme(file:///)が開けなかったので、その考慮を付け加えたもの。
あふw 及び あふwこまんど のインストール先が"%APP%\afxw\"であることが動作条件。環境によって27~29行目を書き換えてもらえばよいかと思う。
Everythingの「規定のファイラーでパスを開く」に登録しておいたり、ブラウザやメーラーの"file:///"のコンテキストメニューに追加したりすると便利なんではないかと思う。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | ' Open with Afxw.vbs ' ver.1.1 dsp74118 ' Description: Open path(Local path/UNC path/URI) with Afxw ' Requirement: あふこまんど(AFXWCMD.EXE) is installed in %APP%\afxw\ ' args: ' path string Option Explicit 'Function UrlDecode ' Description: Decode UTF8-Encoded-URI ' args: ' strSource: Encoded URI string ' return: ' Decoded URI String Function URLDecode(strSource) Dim objSC Set objSC = CreateObject( "ScriptControl" ) objSC.Language = "Jscript" URLDecode = objSC.CodeObject.decodeURIComponent(strSource) Set objSC = Nothing End Function ' main On Error Resume Next Dim wshShell Dim app, afx, opt, quoteChar, SPC, YEN Set wshShell = WScript.CreateObject( "WScript.Shell" ) app = wshShell.ExpandEnvironmentStrings( "%APP%" ) afx = app & "\afxw\AFXWCMD.EXE" opt = "-p" quoteChar = "" "" Dim path, arg, runCmd Set arg = WScript.Arguments If arg.Count = 0 Then WScript.Quit End If path = arg(0) ' convert URI(file scheme) to UNC path = Right(path, Len(path) - 8) path = URLDecode(path) End If runCmd = quoteChar & afx & quoteChar & " " & opt & quoteChar & path & quoteChar wshShell.Run(runCmd) |
0 コメント:
コメントを投稿