home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2002 April
/
VPR0204A.ISO
/
OLS
/
GREP109
/
grep109.lzh
/
searchEx
/
blockGrep.mac
next >
Wrap
Text File
|
2001-12-17
|
2KB
|
96 lines
//block 出力 grep
$ini = macrodir + "\\searchEx\\searchEx.ini";
writeininum $ini,"SEARCH","tmp2",hidemaruhandle(0);
$directory = getinistr($ini,"SEARCH","directory");
$hilight = getinistr($ini,"SEARCH","block");
openreg "CURRENTUSER", "Software\\Hidemaruo\\Hidemaru\\Env";
#PasteCursorFix = getregnum("PasteCursorFix");
writeregnum "PasteCursorFix",0;
envchanged;
closereg;
newfile;
if( !result ){
message "メモリー不足などの理由により、ファイルオープンに失敗しました。";
call PasteCursorFix;
endmacroall;
}
showwindow 0;
writeininum $ini,"SEARCH","tmp",hidemaruhandle(0);
writeininum $ini,"SEARCH","tmp3",getininum($ini,"SEARCH","tmp2");
execmacro macrodir + "\\searchEx\\SetActive.mac";
while( 1 ){
if(code == eof)break;
//disabledraw;
execmacro macrodir + "\\searchEx\\OpenFile.mac";
execmacro macrodir + "\\searchEx\\FindLine.mac";
if( getininum($ini,"SEARCH","NullFind") )continue;
call SelectBlock;
//selectfunc では見つかった行を含むブロックが選択されない場合がある。
if( seltopy == 0 && selendy == linecount -1)call InFile;
else call PastBlock;
}
execmacro macrodir + "\\searchEx\\CloseFile.mac";
call PasteCursorFix;
endmacro;
PastBlock:
$$file = getinistr($ini,"SEARCH","tmp1");
while( 1 ){
if(y == linecount -1)gofileend;
##x = selendx;
##y = selendy;
indent;
appendcopy;
undo;
moveto ##x ,##y;
if( column )addclipboard "\x0D\x0A";
finddown2;
if( !result )break;
addclipboard $$file + "(" + str(lineno) + ")\x0D\x0A";
call SelectBlock;
}
call ChangeWindow;
paste;
return;
ChangeWindow:
writeininum $ini,"SEARCH","tmp3",getininum($ini,"SEARCH","tmp2");
execmacro macrodir + "\\searchEx\\SetActive.mac";
//disabledraw;
movetolineno 1, lineno + 1;
return;
InFile:
$$file = filename;
call ChangeWindow;
##x = x;
##y = y;
insertfile $$file;
if( column )insert "\n";
beginsel;
moveto ##x, ##y;
indent;
moveto selendx,selendy;
escape;
return;
SelectBlock:
##y = y;
//selectfunc では見つかった行を含むブロックが選択されない場合がある。
prevfunc;
beginsel;
nextfunc;
if( y == ##y ){
escape;
beginsel;
nextfunc;
}
return;
PasteCursorFix:
openreg "CURRENTUSER", "Software\\Hidemaruo\\Hidemaru\\Env";
writeregnum "PasteCursorFix",#PasteCursorFix;
envchanged;
return;