////////////////////////////////////////////////// // HOWMANY.MAC by nyan // 秀丸マクロ // // テキスト中に文字列が出現する回数を数えます。テキスト全体が対象。 // 範囲指定してある場合は、それを検索文字列として取り込みます。 // #x0=x; #y0=y; if (selecting) {escape; $c=gettext(seltopx,seltopy,selendx,selendy);} $a = input ("数える文字列 =",$c); if ($a=="") endmacro; menu "Case Nonsensitive","Case Sensitive","Word - Case Nonsensitive", "Word - Case Sensitive","Regular Expression"; #type=result; if (#type==1) $m="Case Nonsensitive"; else if (#type==2) $m="Case Sensitive"; else if (#type==3) $m="Word - Case Nonsensitive"; else if (#type==4) $m="Word - Case Sensitive"; else if (#type==5) $m="Regular Expression"; else endmacro; disabledraw; gofiletop; $sb=searchbuffer; #so=searchoption; loop: if (#type==1) searchdown $a; else if (#type==2) searchdown $a,casesense; else if (#type==3) searchdown $a,word; else if (#type==4) searchdown $a,word,casesense; else if (#type==5) searchdown $a,regular; if (result) {#n=#n+1;goto loop;} moveto #x0,#y0; setsearch $sb, #so; message "There are "+str(#n)+" strings: \""+$a+"\" ("+$m+") in this file.";