//获取自己的Name
macro GetMyName()
{
return " "
}
//格式化日期时间,就是补0
macro FormatNum(Num)
{
if (Num < 10)
{
szNum = “0@Num@”;
}
else
{
return Num;
}
return szNum
}
//获取日期
macro GetDate()
{
G_Date = GetSysTime(1)
Year = G_Date.Year
Month = FormatNum(G_Date.Month)
Day = FormatNum(G_Date.Day)
return "@Year@-@Month@-@Day@"
}
//获取日期时间
macro GetDateTime(Flag)
{
G_Time = GetSysTime(1)
Date = GetDate()
Hour = FormatNum(G_Time.Hour)
Minute = FormatNum(G_Time.Minute)
if (Flag)
{
Second = FormatNum(G_Time.Second)
return "@Date@ @Hour@:@Minute@:@Second@"
}
else
{
return "@Date@ @Hour@:@Minute@"
}
}
//获取文件名
macro GetFileName(PathName)
{
nLength = strlen(PathName)
i = nLength - 1
Name = “”
while (i + 1)
{
ch = PathName[i]
if ("\" == “@ch@”)
{
break
}
i = i - 1
}
i = i + 1
while (i < nLength)
{
Name = cat(Name, PathName[i])
i = i + 1
}
return Name
}
macro CommentFormatNum(Num)
{
if (Num < 10)
{
szNum = “0000@Num@”
}
else if (Num < 100)
{
szNum = “000@Num@”
}
else if (Num < 1000)
{
szNum = “00@Num@”
}
else if (Num < 10000)
{
szNum = “0@Num@”
}
else
{
return Num
}
return szNum
}
//获取当前文件路径
macro Flinger_GetPath()
{
hwnd = GetCurrentWnd()
hbuf = GetCurrentBuf()
lnFirst = GetWndSelLnFirst(hwnd)
FilePath = GetBufName(hbuf)
InsBufLine(hbuf, lnFirst + 1, "@FilePath@")
Sel = GetWndSel(hwnd) //创建一个Selection Record
Sel.LnFirst = lnFirst + 1; //赋值起始行
Sel.LnLast = lnFirst + 1; //赋值结束行
Sel.ichFirst = 0; //赋值选中起始字符
Sel.ichLim = StrLen(FilePath); //赋值选中结束字符
SetWndSel(hwnd, Sel) //设置选中
}
//添加自定义代码块注释,以区别是自己改的代码
macro Flinger_ExegesisCode()
{
lnFirst = GetWndSelLnFirst(GetCurrentWnd())
hbuf = GetCurrentBuf()
date = GetDateTime(0);
InsBufLine(hbuf, lnFirst + 0, “/========================= Flinger Code Start ================