|
僕のマシンだと折りたたむ処理自体そんなに時間がかからないので(といって
もフォルダ数が画面に収まる程度=40個程度)すが、一応、その辺も改良する
と以下のマクロになりました。
さらには、実はバグがありました。それも直しました。
それでほとんど大丈夫かと思います。
loaddll "tkinfo.dll";
#n = dllfunc("DisableDraw", 1);
$account = dllfuncstr("CurrentAccount");
$folder = dllfuncstr("CurrentFolder");
$rootfolder = $folder;
if( $folder != "" ) {
$rootfolder2 = $folder + "\\";
}
openreg "CURRENTUSER", "Software\\Hidemaruo\\TuruKame\\Config";
#dontsel = getregnum("DontSelSF");
#htmlconv = getregnum("HtmlConvFlags");
#regchanged = 0;
if( #dontsel == 0 || (#htmlconv & 0x100) != 0 ) {
#regchanged = 1;
writeregnum "DontSelSF", 1;
writeregnum "HtmlConvFlags", #htmlconv & 0xFFFFFEFF;
closereg;
#n = dllfunc("EnvChangedDanger");
} else {
closereg;
}
#n = dllfunc("SetGrepFolderAutoInvalidate", 0);
#foldercount = 0;
while(1) {
$nextfolder = dllfuncstr("GetNextFolder", $account, $folder );
#x = strstr( $nextfolder, "\\");
if( #x < 0 ) {
break;
}
$nextaccount = leftstr( $nextfolder, #x);
$nextfolder = midstr( $nextfolder, #x + 1, 999 );
if( $nextaccount != $account
|| strlen($nextfolder) <= strlen($rootfolder2)
|| leftstr( $nextfolder, strlen($rootfolder2) ) != $rootfolder2 ) {
break;
}
$folder = $nextfolder;
#foldercount = #foldercount + 1;
}
#n = dllfunc("SelectFolder", $account, $folder);
#foldercount2 = 0;
while(1) {
#n = dllfunc("ExpandFolder", 0);
if( $folder == $rootfolder ) {
break;
}
#foldercount2 = #foldercount2 + 1;
if( #foldercount2 >= #foldercount ) {
if( #regchanged ) {
openreg "CURRENTUSER","Software\\Hidemaruo\\TuruKame\\Config";
writeregnum "DontSelSF", #dontsel;
writeregnum "HtmlConvFlags", #htmlconv;
closereg;
#n = dllfunc("EnvChanged");
#regchanged = 0;
}
}
#n = dllfunc("PrevFolder");
$folder = dllfuncstr("CurrentFolder");
}
if( #regchanged == 0 ) {
openreg "CURRENTUSER", "Software\\Hidemaruo\\TuruKame\\Config";
writeregnum "DontSelSF", #dontsel;
writeregnum "HtmlConvFlags", #htmlconv;
closereg;
#n = dllfunc("EnvChanged");
}
#n = dllfunc("EnableDraw");
endmacro;
|
|