2007-04-10 07:10:47の
そのうち、作ってみたい秀丸エディタのマクロで、作ろうとしていた秀丸エディタのマクロです。
まだ、実際の業務で使用していませんが、ちょっと、手軽にメールを送信することができそうです。
// SendWithOutlook.mac
// v.0.01
// 秀丸の内容をOutlookのメール作成画面を生成する。
//
//参考
// 「h-tom's Warehouse」の「マクロで使うDLL」http://homepage3.nifty.com/_htom/macro/macro_dll.html
//
//あべのりゆき氏が公開されているmacrodll.dllが必要です。(http://www.ms.u-tokyo.ac.jp/~abenori/)
//
// Copyright by 甘党のプログラマ 2007
//
question("Outlookのメール作成ウィンドウで、1行目をメールタイトルにしますか?");
if (result == yes) {
$Title = gettext(0,0,9999,0,0);
$Body = gettext(0,1,0,linecount,0);
}
else {
$Body = gettext(0,0,0,linecount,0);
}
loaddll hidemarudir + "macrodll.dll";
//Set objOutlook = CreateObject("Outlook.Application")
#objOutlook = dllfunc("OLE_INITIALIZE","Outlook.Application");
if (#objOutlook == 0) {
#ret = dllfunc("OLE_CLEAR");
freedll;
message "Outlookのオブジェクト作成に失敗";
endmacro;
}
//message "Outlookのオブジェクト作成に成功";
//Set objOutlookMsg = objOutlook.CreateItem(olMailItem) ※olMailItem=0
#ret = dllfunc("OLE_INVOKE", #objOutlook, "CreateItem", "i", 0);
if (#ret != 0) {
#objOutlookMsg = dllfunc("OLE_GETLASTRESULTDISP");
}
if ( (#ret==0) && (#objOutlookMsg == 0) ){
#ret = dllfunc("OLE_CLEAR");
freedll;
message "olMailItemのオブジェクト作成に失敗";
endmacro;
}
//message "olMailItemのオブジェクト作成に成功";
//objOutlookMsg.Subject = タイトル
#ret = dllfunc("OLE_SETPROPERTYSTR", #objOutlookMsg, "Subject",$Title);
//objOutlookMsg.Body = 本文
#ret = dllfunc("OLE_SETPROPERTYSTR", #objOutlookMsg, "Body",$Body);
//objOutlookMsg.Display
#ret = dllfunc("OLE_INVOKE",#objOutlookMsg, "Display","");
//Set objOutlook = Nothing
#ret = dllfunc("OLE_CLEAR");
freedll;
endmacro;