| 
			|  | 山紫水明さん
 なむnomotoです
 
 下記のマクロが、最終局面で止まってしまいます。
 マクロは実行中状態です。
 以前は問題なかったんですが、なぜでしょうか?
 教えて下さい。
 カラー強調が巧く行ってないせいでしょうか?
 「検索文字列の強調」オプションのせい?
 WindowsXP  秀丸V6.09
 
 //----------------- FieldGrep.mac
 Label:
 $f = "C:\\大正蔵1_55\\Cbeta台湾jis\\最初.txt";
 openfile($f);
 //      showwindow 3;
 if(selecting) $ds = gettext(seltopx, y, selendx, y);
 if(!imestate) imeswitch;
 $s = input("検索語 ・・・・ app検索。正規表現・曖昧検索OK。\n"
 + "使用履歴 Ctrl+F8  FieldGrep.mac V3.01", $ds);
 if(result == 0 ) exit;
 if($s == "" ) { message "検索語がありません。"; goto Label;}
 
 ////// 初期値設定 ////// "最初.txt"
 $mark = ",";//検索除外記号
 #number = 0;    //検索除外記号数(台湾版は 0)
 #aimai = 1;     //1:する 0:しない
 $objectfile = "*.*";// "*.app";
 /////////////////////////
 
 $folder = directory;
 if(#aimai) $aimai = "する";
 else $aimai = "しない";
 while(1){
 menu "app検索 Go!■push here!",
 "検  索  語: " + $s,
 "区切り記号: " + $mark,
 "検索除外記号数: " + str(#number),
 "あいまい検索: " + $aimai,
 "対象ファイル: " + $objectfile,
 "対象フォルダー: " + $folder;
 #r = result;
 if(#r < 1) endmacro;
 if(#r == 1) break;
 else if(#r == 2){
 if(!imestate) imeswitch;
 $s = input("検索語:");
 }else if(#r == 3) $mark = input("記号:");
 else if(#r == 4){
 if(imestate) imeswitch;
 #number = val(input("記号数:"));
 }else if(#r == 5){
 #aimai = (!#aimai);
 if(#aimai == 0) $aimai = "しない"; else $aimai = "する";
 }else if(#r == 6){
 if(imestate) imeswitch;
 $objectfile =
 input("対象ファイル(複数の場合は ; で区切る)",$objectfile);
 }else if(#r == 7){
 question "一段上に切り替えますか?";
 if(result) call UpFolder;
 }
 }
 #c = 0;
 $unit = "[^" + $mark + "]*";
 while(#c < #number){
 $prevset = $prevset + $unit + $mark;
 #c = #c + 1;
 }
 $prevset = "^" + $prevset + ".*";
 $search = $prevset + $s;
 //    message "「" + $s + "」のgrep検索を実行します!\n"+
 //             "中止はダイアログの[中断]ボタンです。";
 title  "しばらくお待ち下さい!【" + $s + "】を大正蔵検索中です。";
 if(#aimai) grep $search, $objectfile,$folder,regular,fuzzy,subdir,icon, sjis;
 else grep $search, $objectfile, $folder, regular, subdir, icon, sjis;
 #my = result;
 if (!result) { message "見つかりませんでした。";
 title 1;  $prevset = "";  goto Label; }
 
 //----- 検索結果のsort
 selectall;
 disabledraw;
 run "sort < con > con";
 //----- 検索結果の語句数
 gofiletop;
 while( 1 ) {
 searchdown2 $s, regular, fuzzy;
 if( result ) #n = #n + 1;
 else break;
 }
 //message str(#n);
 //-----------------------------------------
 gofiletop;
 if(#n > 0 ){
 insert " 検索語:【" + $s + "】" + str(#my) + " 行。" + str(#n) + " 個。\n";
 insert "  ***** ここからタグジャンプができます *****FieldGrep.mac V3.01 \n";
 insert "---------------------------------------------------------\n";
 }
 //------
 //   config "w110";
 call ShowColor;
 endmacro;
 
 
 UpFolder:       //フォルダーを一段上へ
 ##length = strlen($folder);
 ##i = 1;
 while(1){
 if(midstr($folder, ##length - ##i, 1) == "\\") break;
 ##i = ##i + 1;
 }
 $folder = leftstr($folder, ##length - ##i);
 return;
 //***************************************************************************
 ShowColor://検索語の強調表示 山紫水明さんのを加入
 
 $word = $s;
 #handle_1 = hidemaruhandle(0);
 openfile "/h";
 #handle_2 = hidemaruhandle(0);
 if( searchoption >= 16) $flag = str( val($flag) + 16 );
 //正規表現の場合
 if( #aimai ) {
 call Aimai;
 insert $word + "\n";
 } else insert $flag + "," + $word + "\n";
 
 saveas hidemarudir + "\\greptemp.hilight";
 setactivehidemaru #handle_1;
 closehidemaruforced #handle_2;
 loadhilight "greptemp.hilight", 0;
 config "y+ w110";
 //return;
 goto End;
 
 Aimai:
 setactivehidemaru #handle_1;
 title "〜〜〜 カラー表示の準備中です 〜〜〜";
 disabledraw;
 #x_a = x; #y_a = y;
 $$w[0] = "";
 ##i = 1;
 $$words = "";
 $$flag = str( val( $flag ) + 16 );
 $$colsearch = $s;
 gofileend;
 while( 1 ) {
 searchup $$colsearch, regular, fuzzy;
 if( !result )  break;
 ##bx = seltopx;
 ##by = seltopy;
 ##ex = selendx;
 ##ey = selendy;
 moveto ##ex, ##ey;
 moveto ##bx, ##by;
 $$w = gettext( ##bx, ##by, ##ex, ##ey );
 ##k = 0;
 while( ##k <= ##i ) {
 if( $$w == $$w[##k] ) break;//同じものがあれば,比較対照終わり
 ##k = ##k + 1;
 }
 if( ##k > ##i ) {//最後まで同じものがない場合
 $$words = $$words +  $flag + "," + $$w + "\n";
 //if( ##i < 10 ) $cwords = $cwords + $$w + "|";//@
 ##i = ##i + 1;
 $$w[##i] = $$w;
 }
 }
 moveto #x_a, #y_a;//あいまい風検索開始箇所に戻る
 $word = $$words;
 title 0;
 setactivehidemaru #handle_2;
 return;
 
 End:
 
 closehidemaruforced findhidemaru($f);///
 title 0;
 endmacro;
 //-----------------end of FieldGrep.mac --------------------------------//
 
 
 
 
 | 
 |