|
また直してしまいました。検索文字列が1つだけの場合でもうまく動作するよ
うにしました。
loaddll "tkinfo.dll";
if( !dllfunc("IsHidemaruMailGrep") ) {
#n = dllfunc("Bypass_PostMessage", hidemaruhandle(0), 0x111, 40015, 0);
endmacro;
}
$pack = dllfuncstr("GetFindPack");
$s = $pack;
#x = 0;
#len = strlen($s);
#conved = 0;
#mode = 0;
$regular = "";
#count = 0;
while( #x < #len ) {
#code = ascii( midstr( $s, #x, 1 ) );
if( #mode == 0 ) {
// 「"」を探すモード
if( #code == '\"' ) {
#mode = 1;
if( $regular != "" ) {
$regular = $regular + "|";
}
$regular = $regular + "(";
#count = #count + 1;
}
} else if( #mode == 1 ) {
// 「"」の中に入っているモード。
if( #code == '\"' ) {
#mode = 0;
$regular = $regular + ")";
} else if( #code == '\\' ) {
$regular = $regular + "\\\\" + midstr( $s, #x + 1, 1 );
#x = #x + 1;
} else if( #code == '+' || #code == '*' || #code == '('
|| #code == ')' || #code == '[' || #code == ']'
|| #code == '?' || #code == '.' ) {
$regular = $regular + "\\\\" + char(#code);
} else if( (#code >= 0x81 && #code <= 0x9F)
|| (#code >= 0xE0 && #code <= 0xFC) ) {
$regular = $regular + midstr( $s, #x, 2 );
message $regular;
#x = #x + 1;
} else {
$regular = $regular + char(#code);
}
}
#x = #x + 1;
}
if( #count > 1 ) {
#n = dllfunc("SetFindPack", "(\"" + $regular
+ "\", regular, nocasesense, noreturn, target=smallheaderbody)" );
finddown;
if( !result ) {
#n = dllfunc("FindDown");
finddown;
}
if( !foundhilighting ) {
hilightfound;
}
#n = dllfunc("SetFindPack", $pack );
} else {
#n = dllfunc("Bypass_PostMessage", hidemaruhandle(0), 0x111, 40015, 0);
}
|
|