アドレス帳への自動登録No.00460
山紫水明 さん 03/10/15 23:24
 
  山紫水明です。
 
 HIDESOFT8 #14981 からです。以下のようなものです。

       では, (^^)/~

//----------- SupplementAdrs.mac ----------------------------------------//
//                                  2003.10.14  by 山紫水明

//          フォルダ内のメールヘッダからアドレスを抜き出して
//          アドレス帳に仮登録するマクロ

//  アドレス帳に未整理アドレスというグループを作りそこに登録します。
//  そこから適当なグループに移動あるいは削除してください。
//  念のためにホームディレクトリにある "AdrBook.txt" のバックアップをとら
//  れておいた方がいいでしょう。

loaddll "tkinfo.dll";
$cf = dllfuncstr( "CurrentFolder" );
if( $cf == "" || $cf == "受信" )
            $folder = dllfuncstr( "CurrentAccount" ) + "\\受信";
else {
    menu "●フォルダの選択●",
         "&R 受信フォルダ",
         "&C 現在のフォルダ";
    #r = result;
    if( #r < 2 ) endmacro;
    else if( #r == 2 ) $folder = dllfuncstr( "CurrentAccount" ) + "\\受信";
    else $folder = dllfuncstr( "CurrentAccount" ) + "\\"
                + dllfuncstr( "CurrentFolder" );
}
newfile;
disabledraw;
gofiletop;
beginsel;
gofileend;
delete;
#n = dllfunc("SwitchHeaderView", 0);
if( dllfunc( "IsOrikaeshi" ) ) #n = dllfunc( "SwitchOrikaeshi" );
grep "^(From|Cc):", "*.txt", $folder, regular;
replaceallfast "^.+(From|Cc): *", "", regular;
replaceallfast ", *", "\n", regular;
replaceallfast "\\\"", "", regular;//@@@
gofiletop;
Loop:   //重複判定部分は,秀まるおさん作を利用
  #y = y;
  $s = gettext( 0, y, 256, y );
  if( $s != "" ) {
      while(1) {
          searchdown $s;
          if( !result ) break;
          if( gettext( 0, y, 256, y ) == $s ) {
              deleteline;
              up;
              golineend;
          }
      }
  }
  $email = dllfuncstr( "SetEmailOnly", $s );
  $a = dllfuncstr( "FindBook", $s );
  if($a == "" ) {
      if( dllfuncstr( "SetNameOnly", $s ) == $email ) $s = "○," + $email;
      $adr[#i] = $s;
      #i = #i + 1;
  }
  moveto 0, #y;
  down;
  if( result ) goto Loop;
enabledraw;
question "アドレス帳にないものだけを選びますか?";
if( result == no ) goto End;
disabledraw;
selectall;
delete;
#i = #i - 1;
#num = 0;
while( #num <= #i ) {
    insert $adr[#num] + "\n";
    #num = #num + 1;
}
replaceallfast "(^| *)<", ",", regular;
replaceallfast "$", "," + year + "/" + month + "/" + day, regular;
replaceallfast "> *,", ",", regular;
replaceallfast "^.+,,.+\\n", "", regular;//空のアドレス削除
#num = #num - result;
enabledraw;
if( #num <= 0 ) {
    #n = dllfunc("SetAutoPushTimerMilli", 2000, "ok");
    message "未記入はありません,終了します。";
    quit;
}
menu "&A アドレス帳に追加記入する",
     "&X 閉じないで終了する",
     "&Q 閉じて終了する(esc)";
#r = result;
if( #r == 2 ) {
    clearupdated;
    endmacro;
} else if( #r == 3 ) quit;
#hadle = hidemaruhandle(0);
selectall;
copy;
$AdrBook = dllfuncstr( "HomeDir" ) + "AdrBook.txt";
newfile;
disabledraw;
gofiletop;
beginsel;
gofileend;
delete;
#n = dllfunc("SwitchHeaderView", 0);
insertfile $AdrBook;
gofiletop;
searchdown "G1 未整理アドレス";
if( !result ) {
    gofileend;
    insert "G1 未整理アドレス\n";
} else {
    escape;
    gofileend;
}
paste;
closehidemaruforced #hadle;
saveas $AdrBook;
#n = dllfunc("SetAutoPushTimerMilli", 2000, "ok");
message "未整理アドレスグループに追加しました。";
quit;
//-------------------------------------------------------------------//


[ ]
RE:00460 アドレス帳への自動登録No.00461
山紫水明 さん 03/10/16 07:47
 
山紫水明です。
すみません。バグがありました。64行目
if( result == no ) goto End;

endmacro;
に変えてください。

     では, (^^)/~

[ ]
RE:00461 アドレス帳への自動登録No.00464
山紫水明 さん 03/10/16 21:46
 

》if( result == no ) goto End;
》を
》endmacro;
》に変えてください。

 すません,訂正のバグです。

if( result == no ) goto End;

if( result == no ) endmacro;
でした。

     では, (^^)/~
                                  山紫水明

[ ]