「スクリプト集」の編集履歴(バックアップ)一覧に戻る
スクリプト集 - (2007/10/11 (木) 18:33:19) のソース
&topicpath(top=トップ) **hyperqm QMAIL3の全文検索をちょっぴりGmail風にするツール QMAIL3はHyper Estraierと組み合わせて使用することで、高速な全文検索を行うことができます。 大変便利で強力な機能なのですが、メール本文に対しての検索しか行うことができません。 メールの属性(送信者、宛先、日時、etc)を対象とした条件も使用できれば・・・。 そんな思いから、このツールを作ってみました。(引用) Musee d'Dimanche http://freemind.s57.xrea.com/hyperqm/ **hyperqm.exeをちょっぴり使いやすくするツール hyperqm.js -hyperqm.exeのソースをJScriptに移植したもの。 -hyperqm.exeと同じフォルダにhyperqm.jsというファイル名でソースを保存して使ってください。 -QMAIL3検索オプションでカスタムにして検索のところを「cscript hyperqm.js "$index" "$condition" $encoding」とする。 -検索式もhyperqm.exeと同じでそれに加えて下記が可能。 +属性のOR:「from,cc:hoge,foo」とすれば「hoge」または「foo」が「fromまたはcc」にあるメールを検索。→「"from,cc:hoge foo"」と「"」で括って検索対象を「半角空白」で区切っても可。 +属性の否定:「hoge -from:foo」とすれば、本文に「hoge」を含み「from」が「foo」を含まないメールを検索。 >main(); >function main(){ >var WshShell, ARGV, index, char_code, attr_str, search_phrase, objExecl, parser; >var WshShell = new ActiveXObject('WScript.Shell'); >ARGV = WScript.Arguments; >index = ARGV(0); >char_code = ARGV(2); >var parser = new StringParser(ARGV(1)); >attr_str = parser.attr_str; >search_phrase = parser.search_phrase; >var objExec = WshShell.Exec('estcmd search -nl -ic ' + char_code + ' -vu -aux 99 -max -1' + attr_str + ' "' + index + '" "' + >search_phrase + '"'); >while(!objExec.StdOut.AtEndOfStream) { >WScript.StdOut.WriteLine(objExec.StdOut.ReadLine()); >} >} > >function StringParser(arg){ >var inputted_str, search_phrase; >inputted_str = arg >search_phrase = ''; >var attribute_condition_ary = new Array(); >var r, str; >while(r=inputted_str.match(/\"(.*?)\"/)){ >str = inputted_str.slice(r.index + 1, r.lastIndex - 1); >if(str.indexOf(':') != -1){ >attribute_condition_ary.push(attribute(str)); >}else{ >if(search_phrase.length > 0){ >search_phrase += ' AND '; >} >search_phrase += str; >} >inputted_str = inputted_str.slice(0,r.index) + inputted_str.slice(r.lastIndex); >} > >var strs, key; >strs = inputted_str.split(/ | /); >for(key in strs){ >str = strs[key]; >if(!str){continue;} >if(str.indexOf(':') != -1){ >attribute_condition_ary.push(attribute(str)); >continue; >} >if(search_phrase.length > 0){ >if(str == 'OR'){ >search_phrase += ' OR'; >continue; >}else if(search_phrase.match(/.+ OR$/)){ >search_phrase += ' '; >}else if(str.charAt(0) == '-'){ >search_phrase += ' ANDNOT '; >str = str.slice(1); >}else{ >search_phrase += ' AND '; >} >} >search_phrase += str; >} > >if(search_phrase.length == 0){ >search_phrase = '[UVSET]'; >} > >var attr_str; >attr_str = ''; >if(attribute_condition_ary && attribute_condition_ary.length > 0){ >for(key in attribute_condition_ary){ >attr_str += ' -attr "' + attribute_condition_ary[key] + '"'; >} >} >this.source = arg; >this.attr_str = attr_str; >this.search_phrase = search_phrase; >} > >function attribute(str){ >var str_ary; >str_ary = str.split(':'); >if(!str_ary){return} >if(str_ary[0] == 'after'){ >return "@cdate NUMGE " + Math.round(Date.parse(str_ary[1])/1000); >}else if(str_ary[0] == 'before'){ >return "@cdate NUMLT " + (Math.round(Date.parse(str_ary[1])/1000) + 60*60*24); >}else if(str_ary[1].match(/,| |\|/)){ >return str_ary[0] + " ISTRRX " + str_ary[1].replace(/,| |\|/g,'|'); >}else if(str_ary[0].charAt(0) == '-'){ >return str_ary[0].slice(1) + " !ISTRINC " + str_ary[1]; >}else{ >return str_ary[0] + " ISTRINC " + str_ary[1]; >} >} **標準ブラウザ以外で開くスクリプト Browser.js >var browser = "iexplore.exe"; > //var browser = "opera.exe"; > //var browser = "firefox.exe"; > //var browser = "Netscp.exe"; > >actionTarget.invokeAction("EditCopy"); >var macro = macroParser.parse("@Clipboard()"); >var url = macro.evaluate(application.nothing, application.nothing); > >var shell = new ActiveXObject("WScript.Shell"); >shell.Run(browser + " " + url); 起動したいブラウザのコメント(//)はずしてください。 上記ではIEが起動してます。