|
こんにちは“kiwikazuya”さん、白雲斎です。
>また、任意のメモについては、「表示範囲」も「検索して一覧」も
>必要ないと考えていますので、この機能は必要ではありません。
では、下記のマクロをどうぞ。
loaddll "TKInfo.dll";
if( !result ) endmacro;
if( !dllfunc("IsHidemaruMail") ) endmacro;
if( dllfunc("IsHidemaruMailGrep") ) endmacro;
if( dllfunc("IsHidemaruMailMain") )
{
$s = dllfuncstr("CurrentFolder");
#n = dllfunc("CurrentPane");
if( #n == 0 &&
($s == "" || $s == "受信ログ" || $s == "送信ログ") ) endmacro;
if( #n == 1 )
{
#n = dllfunc("SelectedMailCount");
if( #n == 1 ) call WriteMemoView;
else if( #n > 1 )
{
if( hidemarucount == 1 ) call WriteMemoList;
else message "複数選択しての実行は、\n" +
"開かれたメールがない状態で実行してください!";
}
}
else if( #n == 2 )
{
call WriteMemoView;
}
else
{
message "メール一覧枠か内容枠で実行してください!";
}
}
else
{
call WriteMemoEditor;
}
endmacro;
// 受信、送信済みメールでは 1 (書込み可)
// それ以外は 0 (書込み不可)を返す
ChkMailType:
##n = dllfunc("MailType");
if( ##n < 3 || ##n > 4 ) return 0;
return 1;
SetMemoEditor:
if( updated ) ##update = true;
else ##update = false;
##r = readonly;
if( ##r ) ##n = dllfunc("EnableEdit");
$$s = dllfuncstr("SetHeader", "X-Memo", $$1);
if( !##update )
{
##n = dllfunc("AlterSave");
##n = dllfunc("SetMailFlag", "altered", 0);
}
//if( ##r ) readonlyswitch;
if( ##r ) ##n = sendmessage(hidemaruhandle(0),0x0111,40083,0);
return;
SetMemoList:
##n = dllfunc("BeginEditMail");
$$s = dllfuncstr("SetHeader", "X-Memo", $$1);
##n = dllfunc("SaveEditMail", 0, 0);
return;
GetNewMemo:
if( dllfunc("GetMailFlag", "memo") )
$$memo = dllfuncstr("CurrentHeader", "X-Memo");
else
$$memo = "";
$$memo = input("メモの入力", $$memo);
if( $$memo == "" ) endmacro;
return $$memo;
// エディタ・ウインドウ
WriteMemoEditor:
call ChkMailType;
if( ##return == 0 ) return;
call GetNewMemo;
call SetMemoEditor $$return;
return;
// メール内容枠
WriteMemoView:
call ChkMailType;
if( ##return == 0 ) return;
call GetNewMemo;
$$memo = $$return;
##wnd = dllfunc("OpenedEditorWnd");
if( ##wnd )
{
setactivehidemaru ##wnd;
call SetMemoEditor $$memo;
}
else
{
call SetMemoList $$memo;
}
return;
// メール一覧枠
WriteMemoList:
$$kword = input("メモの入力");
if( $$kword == "" ) endmacro;
question "既存のメモがある場合、追記しますか?\n\n" +
"「いいえ」で上書き";
##isAdd = result;
##n = dllfunc("DisableDraw", 0);
##n = dllfunc("LockSelection");
while(1)
{
if( dllfunc("EnumSelection", 1) <= 0 ) break;
call ChkMailType;
if( ##return == 0 ) continue;
if( dllfunc("GetMailFlag", "memo") == 1 && ##isAdd == true )
{
$$memo = dllfuncstr("CurrentHeader", "X-Memo");
if( strstr($$memo, $$kword) != -1 ) continue;
}
else
{
$$memo = "";
}
call SetMemoList $$kword + $$memo;
}
##n = dllfunc("UnlockSelection", 1);
##n = dllfunc("EnableDraw");
return;
|
|