最近使ったファイルの一覧から拡張子が emlのものを削除するマクロ
私的メモ。
WZ6のマクロ。
--------------------------------------------
#include <windows.h>
#include <text.h>
#include
author:ES
name: ツールマクロ
title: ツール
debug: 0
del_hist_eml {
title: 履歴から拡張子 emlのものを削除する
tool: del_hist_eml
CLM fn = "wzcfg://idFHIST.hst";
HTEXT txtHist = new();
UINT mode = TEXTFILE_SHARE_RW|LOAD_CONT;
if ( !loadex( txtHist, fn, mode ) )
{
information( "履歴ファイルを開くことが出来ませんでした" );
return;
}
HTEXT txtNewHist = new();
int cntDel = 0;
for ( jumptop(txtHist); !iscureof(txtHist); jumpnextpara(txtHist) )
{ // 段落の取得
mchar* p = getcurparabuff(txtHist);
HTEXT txtPara = new();
for ( ; !isreturn(*p); p += buffgetcharsize( p ) )
{
addbuff( txtPara, p, buffgetcharsize(p) );
}
jumpend( txtPara );
jumptop( txtPara );
mchar* pExt = pathgetext( txtPara );
int res = stricmp( pExt, ".eml" );
if ( res != 0 )
{
add( txtNewHist, txtPara );
add( txtNewHist, "\n" );
}
else
{
cntDel++;
}
}
if ( cntDel == 0 )
{
information( "履歴ファイルは更新されませんでした。" );
}
else if ( saveto( txtNewHist, fn ) )
{
information( "履歴ファイルの更新を終了しました。" );
}
else
{
information( "履歴ファイルの更新に失敗しました" );
}
}
WZ6のマクロ。
--------------------------------------------
#include <windows.h>
#include <text.h>
#include
author:ES
name: ツールマクロ
title: ツール
debug: 0
del_hist_eml {
title: 履歴から拡張子 emlのものを削除する
tool: del_hist_eml
CLM fn = "wzcfg://idFHIST.hst";
HTEXT txtHist = new();
UINT mode = TEXTFILE_SHARE_RW|LOAD_CONT;
if ( !loadex( txtHist, fn, mode ) )
{
information( "履歴ファイルを開くことが出来ませんでした" );
return;
}
HTEXT txtNewHist = new();
int cntDel = 0;
for ( jumptop(txtHist); !iscureof(txtHist); jumpnextpara(txtHist) )
{ // 段落の取得
mchar* p = getcurparabuff(txtHist);
HTEXT txtPara = new();
for ( ; !isreturn(*p); p += buffgetcharsize( p ) )
{
addbuff( txtPara, p, buffgetcharsize(p) );
}
jumpend( txtPara );
jumptop( txtPara );
mchar* pExt = pathgetext( txtPara );
int res = stricmp( pExt, ".eml" );
if ( res != 0 )
{
add( txtNewHist, txtPara );
add( txtNewHist, "\n" );
}
else
{
cntDel++;
}
}
if ( cntDel == 0 )
{
information( "履歴ファイルは更新されませんでした。" );
}
else if ( saveto( txtNewHist, fn ) )
{
information( "履歴ファイルの更新を終了しました。" );
}
else
{
information( "履歴ファイルの更新に失敗しました" );
}
}