|   |  
 RUXTOR さん今日は、ひろです。 
> 一括保存後未読を既読にできないでしょうか。 
 できます。 
 未読のみ且つ既読にするということなので、NextUnreadCustom を使えばよいです。 
//----------------------------------------------------------------------------- 
loaddll "tkinfo.dll"; 
if( dllfunc("IsThreadView") ) { 
  message "スレッド表示だと実行できません。"; 
  goto End; 
} 
#viewarea = dllfunc("ViewArea"); 
if( #viewarea != 5 ) { 
  #n = dllfunc("SetViewArea", 5); 
} 
#total = dllfunc("MailCount"); 
if( #total == 0 ) { 
  message "添付ファイル付きメールが1つもありません。"; 
  #n = dllfunc("SetViewArea", #viewarea ); 
  goto End; 
} 
#i = 0; 
 
$ini = dllfuncstr( "HomeDir" ) + "tkmail.ini"; 
$folder = dllfuncstr( "CurrentAccount" )+ "\\" + dllfuncstr( "CurrentFolder" ); 
$dest = getinistr( $ini,"SAVEFOLDER",$folder); 
if( $dest == "" ){ 
  #dest = dllfunc( "Bypass_MessageBox", hidemaruhandle(0), 
    "フォルダは設定されていません!!\n" + 
    "設定しますか?\n" + 
    "はい:設定\n" + 
    "いいえ:設定せず今回限り\n" + 
    "キャンセル:マクロ終了", 
    "保存フォルダの設定",0x23); 
} 
if( #dest == 2 )goto End; 
 
InputPath: 
  if( $dest == "" ){ 
    $dest = input( "添付ファイルを保存する先のフォルダのフルパス名は?" 
           + "\n\n(例: c:\\folder)" ); 
    if( $dest == "" ) { 
      goto End; 
    } 
    if( ! existfile( $dest + "\\." ) ) { 
      message "指定されたフォルダが存在しません。" 
        + "入力しなおしてください。"; 
      $dest = ""; 
      goto InputPath; 
    } 
  } 
  if( #dest == 6 )writeinistr $ini, "SAVEFOLDER", $folder, "\"" + $dest + "\""; 
  $account = dllfuncstr("HomeDir") + dllfuncstr("CurrentAccount"); 
  #id0 = dllfunc( "MailIndex" ); 
  if( !dllfunc( "IsUnread" ) )#tmp = dllfunc( "NextUnreadCustom" , "Roll" ); 
  #id1 = dllfunc( "MailIndex" ); 
  while( #id0 != #id1 ) { 
    #id0 = #id1; 
    #x = 0; 
    $attach = dllfuncstr("CurrentHeader", "X-Attach"); 
    if( $attach != "" ) { 
      $src = $account + "\\" + $attach; 
      // フォルダ名のみに変換する。 
      #xFolder = -1; 
      #xFile = -1; 
      while(1) { 
        #x = strstr( midstr( $src, #xFile + 1, 256 ), "\\" ); 
        if( #x < 0 ) { 
          break; 
        } 
        #x = #x + #xFile + 1; 
        #xFolder = #xFile; 
        #xFile = #x; 
      } 
      $src = leftstr( $src, #xFile ); 
      if( existfile($src) ){ 
        //フォルダごと 
        //$command = "xcopy.exe \"" + $src + "\" \"" 
        //  + $dest + "\\" + midstr( $src, #xFolder + 1, 256 ) 
        //ファイルだけの場合 
        $command = "xcopy.exe \"" + $src + "\\*\" \"" + $dest 
          + "\" /S /I /Y"; 
        //            ^^確認せずに上書き 
        runsync2 $command; 
      } 
    } 
    #tmp = dllfunc( "NextUnreadCustom" , "Roll" ); 
    #id1 = dllfunc( "MailIndex" ); 
  } 
  #n = dllfunc("SetViewArea", #viewarea ); 
  run "start " + $dest; 
 
End: 
  freedll; 
  endmacro; 
 
			 | 
		  
	 |