Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // JaneXeno用クソbeが立てたスレを一括スレッドあぼ~んするコマンド
- // 【使い方】
- // ThreadAbon.js をどこかに保存(x:\somewhere\ThreadAbon.js)
- // command.dat に以下を追加
- // このbeが立てたスレをあぼ~ん=wscript x:\somewhere\ThreAdabon.js "$LOCALDAT"
- // クソbeが立てたスレを開き右クリック→このbeが立てたすれをあぼ~ん を選択
- //
- var ForReading = 1;
- var ForWriting = 2;
- var ForAppending = 8;
- var abonmode = 2;
- var wsh = WScript.CreateObject("WScript.Shell");
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- var datfile = WScript.Arguments(0);
- if(datfile.match(/.*\\(.+?)\\\d{10}\.dat/))
- {
- switch(RegExp.$1)
- {
- case "ニュース速報":
- board = "news";
- break;
- case "ニュー速(嫌儲)":
- board = "poverty";
- break;
- default:
- wsh.Popup("対象外の板です", -1, "", 48);
- WScript.Quit();
- }
- }
- else
- {
- wsh.Popup("datの指定がオカシイ", -1, "", 48);
- WScript.Quit();
- }
- //
- //既存のNGスレッドを読み込み
- //
- var abnfile = fso.BuildPath(fso.GetParentFolderName(datfile), "subject.abn");
- var st_abn = fso.OpenTextFile(abnfile, ForReading,true);
- var NGThreads = new Array();
- while (st_abn.AtEndOfLine==false)
- {
- strText = st_abn.ReadLine();
- if(strText.match(/(\d{10})=(\d) (.+)/))
- {
- NGThreads[RegExp.$1] = RegExp.$3;
- }
- }
- st_abn.Close();
- //
- // Subject.txtからスレ一覧を取得
- //
- var subjecttxt = fso.BuildPath(fso.GetParentFolderName(datfile), "subject.txt");
- var st_subject = fso.OpenTextFile(subjecttxt, ForReading);
- var subjectlist = new Array();
- while (st_subject.AtEndOfLine==false)
- {
- strText = st_subject.ReadLine();
- if(strText.match(/(\d+?)\.dat<>(.+)/))
- {
- subjectlist[RegExp.$1] = RegExp.$2;
- }
- }
- st_subject.Close();
- //
- //datの>>1からBE IDを取得
- //
- var st_dat = fso.OpenTextFile(datfile, ForReading, false);
- var ichi = st_dat.ReadLine();
- st_dat.Close();
- //WScript.Echo(ichi);
- if(!ichi.match(/.*? BE:(\d+?)-.*<>/))
- {
- WScript.Echo();
- wsh.Popup("BE IDの取得に失敗しました", -1, "", 48);
- WScript.Quit();
- }
- //
- // BEストーカーからこのBEが立てたスレのリストを取得
- //
- var url = "http://kiki.mods.jp/be/stalker/"+ RegExp.$1 +"/"+board+"/";
- //wsh.Run(url);
- var html = "";
- var req = new ActiveXObject("Microsoft.XMLHTTP");
- req.open('GET', url, false);
- req.onreadystatechange = function (aEvt)
- {
- if (req.readyState == 4)
- {
- if(req.status == 200)
- {
- html = req.responseText;
- //WScript.Echo(req.responseText);
- }
- else
- {
- WScript.Echo("Error loading page\n");
- WScript.Quit();
- }
- }
- };
- req.send(null);
- var abonstr = "";
- var newNGThreads = new Array();
- while(html.match(/ {36}(.+?)\r?\n {20}<a href=".+?" target="_blank" title="みみずん過去ログ"><img src="\/be\/images\/mimizun.com.png" alt="みみずん" width="16" height="16"><\/a>\r?\n {20}<a href=".+?" target="_blank" title="unkar過去ログ"><img src="\/be\/images\/unkar.org.png" alt="unkar" width="16" height="16"><\/a>\r?\n {20}<br>\r?\n {20}<a href=".+?" target="_blank">http:\/\/[^\/\.]+?.2ch.net\/test\/read.cgi\/[^\/]+?\/(\d{10})\/<\/a><br>/))
- {
- //WScript.Echo(RegExp.$2 + ": " + RegExp.$1 +"\n"+NGThreads[RegExp.$2]+"\n"+subjectlist[RegExp.$2]);
- if(!NGThreads[RegExp.$2]&& subjectlist[RegExp.$2])
- {
- // "~"文字がおかしいので置換しておく
- newNGThreads[RegExp.$2] = RegExp.$1.split(String.fromCharCode(0x301c)).join("~");
- abonstr += RegExp.$2 + ": " + RegExp.$1 + "\n";
- //WScript.Echo("Found " + RegExp.$2 +" "+ newNGThreads[RegExp.$2]);
- }
- html = RegExp.rightContext;
- }
- if (abonstr == "")
- {
- wsh.Popup("新着スレッドはありません", -1, "", 64);
- WScript.Quit();
- }
- if(wsh.Popup(abonstr + "\n以上をスレッドあぼ~んしますか?", -1, "", 4 | 32) != 6)
- WScript.Quit();
- st_abn = fso.OpenTextFile(abnfile, ForAppending, true);
- for(key in newNGThreads)
- {
- //WScript.Echo("Found " + newNGThreads[RegExp.$1]);
- try
- {
- st_abn.WriteLine(key+"="+abonmode+" "+ newNGThreads[key]);
- }
- catch (e)
- {
- wsh.Popup(key+"="+abonmode+" "+ newNGThreads[key] + "を追加する際にエラーが起きました", -1, "", 48);
- var str = "";
- for(i=0; i< newNGThreads[key].length; i++)
- {
- str +=" "+ newNGThreads[key].charCodeAt(i);
- }
- WScript.Echo(str);
- }
- }
- st_abn.Close();
- //
- // スレ欄(L)→ボードデータを再構成(R)アクセラレータキーを送信
- //
- wsh.SendKeys("%LR");
- WScript.Echo("(・∀・)カンリョウ!! ");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement