23/06/15 11:10:02.65 MF5zr4AY0.net
SearchEx.wsfからコードを拝借して作ってみたのでよければどうぞ
var fso = WScript.CreateObject('Scripting.FileSystemObject');
var cmd = WScript.CreateObject('Shell.Application');
var url = WScript.Arguments.length && WScript.Arguments(0);
var dir = ExeDir(WScript.ScriptFullName);
var brw =
GetINI('External', 'BrowserSpecified', '0', dir + 'Jane2ch.ini') != 0 ?
GetINI('External', 'BrowserPath', '', dir + 'Jane2ch.ini') : '';
url = url.replace(/^(.+)https:.*$/,"$1").replace(/read\.cgi\/(?!c\/)/i, "read.cgi/c/");
cmd.ShellExecute(brw || url, brw && url);
function ExeDir(p) {
while (p = p.replace(/[^\\]*\\?$/, '')) if (fso.FileExists(p + 'Jane2ch.exe')) return p;
}
function GetINI(sct, key, def, ini) {
var m = load(ini).match(RegExp(expand('^\\[$0\\]\\r\\n(?:.*\\r\\n)*?(?:$1=(.*)|\\[.*\\])\\r\\n', arguments), 'im'));
return m && m[1] || def;
}
function load(p) {
var f = fso.OpenTextFile(p, 1, 1), x = '';
try {x = f.ReadAll();} catch (e) {}
f.Close();
return x;
}
function expand(s, v) {
return s.replace(/\$(\d)/g, function (m, n) {return n in v ? v[n] : m;});
}