home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2002 April
/
VPR0204A.ISO
/
OLS
/
GREP109
/
grep109.lzh
/
searchEx
/
grepAndDlg.mac
< prev
next >
Wrap
Text File
|
2001-09-28
|
6KB
|
179 lines
//絞り込み grep の dialog
disablebreak;
$ini = macrodir + "\\searchEx\\searchEx.ini";
$search = getinistr($ini,"SEARCH","string");
#otherOption = getininum($ini,"SEARCH","otherOption");
#joint = getininum($ini,"SEARCH","joint");
call Dialog;
goto End;
End:
writeinistr $ini,"SEARCH","tmp","\"" + $search + "\"";
writeininum $ini,"SEARCH","SearchOption",0;
execmacro macrodir + "\\searchEx\\history.mac";
freedll;
endmacro;
Dialog://設定 dialog
loaddll hidemarudir + "\\DengakuDLL.dll";
//option 部の作成
if(!(dllfunc("NEWDLGPAGE","OPTION",23) &&
dllfunc("NEWCONTROL","check","UpLower","大文字/小文字の区別(&C)")))goto DllError;
if(searchoption&2)if(!dllfunc("SETCTRLSTATE","","1"))goto DllError;
if(!dllfunc("NEWCONTROL","check","word","単語の検索(&W)"))goto DllError;
if(searchoption&1)if(!dllfunc("SETCTRLSTATE","","1"))goto DllError;
if(!dllfunc("NEWCONTROL","check","regular","正規表現(&R)"))goto DllError;
if(searchoption&16)call RegON;
if(!(dllfunc("SETCTRLNOTIFY","","1016") &&
dllfunc("NEWCONTROL","check","fuzzy","あいまい検索(&F)")))goto DllError;
if(searchoption&32)if(!dllfunc("SETCTRLSTATE","","1"))goto DllError;
if(!(dllfunc("SETCTRLNOTIFY","","1032") &&
dllfunc("NEWCONTROL","check","joint","指定文字列の無視(&J)") &&
dllfunc("SETCTRLNOTIFY","","4")))goto DllError;
call JointList;
if(#otherOption&4){
if(!dllfunc("SETCTRLSTATE","joint","1"))goto DllError;
call RegON;
}
else if(!dllfunc("ENABLECTRL",0,"jointList"))goto DllError;
//本体
if(!(dllfunc("NEWDIALOG","絞り込み grep の実行",45) &&
dllfunc("NEWCONTROL","text","","検索文字列(&S)") &&
dllfunc("SETCTRLWIDTH","",11) &&
dllfunc("NEWCONTROL","combo","search",$search)))goto DllError;
writeinistr $ini,"SEARCH","tmp","SEARCHHISTORY";
execmacro macrodir + "\\searchEx\\combo.mac";
if(!(dllfunc("NEWCONTROL","text","","")&&
dllfunc("SETCTRLWIDTH","",3)&&
dllfunc("NEWCONTROL","frame","","") &&
dllfunc("SETCTRLITEM","","OPTION") &&
dllfunc("NEWCOLUMN",19) &&
dllfunc("NEWCONTROL","defbutton","","OK") &&
dllfunc("SETCTRLNOTIFY","","1") &&
dllfunc("NEWCONTROL","button","","キャンセル") &&
dllfunc("SETCTRLNOTIFY","","0") &&
dllfunc("NEWCONTROL","button","","無視する文字の設定(&1)") &&
dllfunc("SETCTRLNOTIFY","","2")))goto DllError;
if(#extension)if(!dllfunc("ENABLECTRL",0,"fileOnly"))goto DllError;
if(!dllfunc("SHOWDIALOG",hidemaruhandle(0),0))goto DllError;
while(1){
$$data = "";
while(strlen($$data) == 0)$$data = dllfuncstr("WAITCTRLNOTIFY",1);
##notify = val($$data);
if(##notify < 4)break;
else if(##notify == 4)call JointOn;
else if(##notify == 5){
$$data = dllfuncstr("GETCTRLSTRING","file");
call GetFileName $$data;
$$data = dllfuncstr("GETCTRLSTRING","dir") + "\\" + $$return;
if(!dllfunc("SETCTRLSTRING","file",$$data))goto DllError;
}
else if(##notify == 1016)call SetRegular;
else if(##notify == 1032){
$$data = dllfuncstr("GETCTRLSTATE","fuzzy");
if($$data == "1")if(!dllfunc("SETCTRLSTATE","regular","1"))goto DllError;
call SetRegular;
}
}
if(!dllfunc("ENDDIALOG"))goto DllError;
if(##notify == 0)goto EndAll;
$search = dllfuncstr("GETCTRLSTRING","search");
$$data = dllfuncstr("GETCTRLSTRING","file");
call GetFileName $$data;
if($$return == $$data){
$directory = directory2;
$file = $$data;
}
else{
$file = $$return;
$directory = leftstr($$data,strlen($$data) - strlen($file) - 1);
}
if(dllfuncstr("GETCTRLSTATE","fuzzy") == "1")#option = 48;
else if(dllfuncstr("GETCTRLSTATE","regular") == "1")#option = 16;
else{
if(dllfuncstr("GETCTRLSTATE","word") == "1")#option = 1;
if(dllfuncstr("GETCTRLSTATE","UpLower") == "1")#option = #option|2;
}
if(dllfuncstr("GETCTRLSTATE","fileOnly") == "1")#option = #option|64;
#otherOption = val(dllfuncstr("GETCTRLSTATE","subdir"));
if(dllfuncstr("GETCTRLSTATE","fullpath") == "1")#otherOption = #otherOption|2;
if(dllfuncstr("GETCTRLSTATE","joint") == "1"){
#otherOption = #otherOption|4;
writeinistr $ini,"SEARCH","joint",dllfuncstr("GETCTRLSTATE","jointList");
}
writeininum $ini,"SEARCH","option",#option;
writeininum $ini,"SEARCH","otherOption",#otherOption;
writeinistr $ini,"SEARCH","string","\"" + $search + "\"";
if(##notify == 1)return;
else if(##notify == 2)execmacro macrodir + "\\searchEx\\stringDlg.mac";
goto Dialog;
GetFileName://file name だけ取得
while(1){
##extension=strstr($$1,";");
if(##extension==-1)break;
##extension=strlen($$1)-##extension-1;
$$1=rightstr($$1,##extension);
}
while(1){
##extension=strstr($$1,"\\");
if(##extension==-1)break;
##extension=strlen($$1)-##extension-1;
$$1=rightstr($$1,##extension);
}
return $$1;
SetRegular://正規表現の ON/OFF
$$state = dllfuncstr("GETCTRLSTATE","regular");
if($$state == "1"){
if(!(dllfunc("ENABLECTRL",0,"word") &&
dllfunc("ENABLECTRL",0,"UpLower")))goto DllError;
}
else if($$state == "0"){
if(!(dllfunc("ENABLECTRL",1,"word") &&
dllfunc("ENABLECTRL",1,"UpLower") &&
dllfunc("SETCTRLSTATE","fuzzy","0") &&
dllfunc("SETCTRLSTATE","joint","0") &&
dllfunc("ENABLECTRL",0,"jointList")))goto DllError;
}
return;
JointOn://文字列無視の ON/OFF
if(!val(dllfuncstr("GETCTRLSTATE","joint"))){
if(!dllfunc("ENABLECTRL",0,"jointList"))goto DllError;
}
else{
if(!dllfunc("ENABLECTRL",1,"jointList"))goto DllError;
if(!val(dllfuncstr("GETCTRLSTATE","regular")))call RegON;
}
return;
RegON://正規表現 ON
if(!(dllfunc("SETCTRLSTATE","regular","1") &&
dllfunc("ENABLECTRL",0,"word") &&
dllfunc("ENABLECTRL",0,"UpLower")))goto DllError;
return;
DllError://DLL error の処理
message "DLL機能の利用が出来ませんでした。\nマクロを終了します。";
EndAll:
freedll;
endmacroall;
JointList://文字列無視の list 作成
if(!(dllfunc("NEWCONTROL","text",""," 種類(&2)") &&
dllfunc("SETCTRLWIDTH","",9) &&
dllfunc("NEWCONTROL","list","jointList","") &&
dllfunc("SETCTRLHEIGHT","",1)))goto DllError;
##i = 0;
while(##i < 10){
$$tmp = getinistr($ini,"STRING",str(##i));
if($$tmp == "")break;
if(!dllfunc("SETCTRLITEM","",$$tmp,"-1"))goto DllError;
##i = ##i + 1;
}
if(!dllfunc("SETCTRLSTATE","",str(#joint)))goto DllError;
return;