|
テスト (2).txt
みたいに半角空白1つ入れてカッコ付きで数字を入れるようにしてみました。
------------------------------------------------------------------------------
$destfolder = "e:\\temp\\test";
loaddll "tkinfo.dll";
$prevaccount = dllfuncstr("CurrentAccount");
$prevfolder = dllfuncstr("CurrentFolder");
while( dllfunc( "SelectRecvMail" ) ) {
#count = dllfunc("CountCurrentHeader", "X-Attach");
if( #count > 0 ) {
#i = 0;
while( #i < #count ) {
$attach = dllfuncstr("CurrentHeader2", "X-Attach", #i);
if( dllfuncstr("ToLower", rightstr($attach,4)) == ".p7s" ) {
//スキップ
} else {
$src = dllfuncstr("HomeDir") + dllfuncstr("CurrentAccoun
t") + "\\" + $attach;
$basename = midstr( $attach, strrstr($attach, "\\") + 1 );
$dest = $destfolder + "\\" + $basename;
if( existfile($dest) ) {
#ext = strrstr( $dest, "." );
if( #ext > 0 ) {
$destbase = leftstr( $dest, #ext );
$destext = midstr( $dest, #ext );
} else {
$destbase = $dest;
$destext = "";
}
#destnum = 2;
while( #destnum < 1000 ) {
$dest = $destbase + " (" + str(#destnum) + ")" +
$destext;
if( ! existfile($dest) ) {
break;
}
#destnum = #destnum + 1;
}
}
#n = dllfunc("Bypass_CopyFile", $src, $dest, 0 );
#n = dllfunc("Bypass_SetFileAttributes", $dest, 0x20 );
}
#i = #i + 1;
}
}
if( ! dllfunc("IsUnread") ) {
#n = dllfunc("SwitchUnread");
}
}
#n = dllfunc("SelectFolder", $prevaccount, $prevfolder);
|
|