📄 taskremind.vbs
字号:
'********************************************************************************
' 文件名:taskremind.vbs
' 功 能:用VBScript实现若干客户端函数
' 函数列表:
' SetRemindData(sRemindMethod)
' SetNeverRemind
' SetAheadMinutesRemind(nMinutes)
' SetAheadHoursRemind(nHours)
' SetAheadDaysRemind(nDays)
' SetLoopDayRemind(day_hour, day_minute)
' SetLoopWeekRemind(week_day, week_hour, week_minute)
' SetLoopMonthRemind(month_day, month_hour, month_minute)
' DisableRemind
' DisableRemindAheadMinute(bDisabled)
' DisableRemindAheadHour(bDisabled)
' DisableRemindAheadDay(bDisabled)
' DisableRemindDay(bDisabled)
' DisableRemindWeek(bDisabled)
' DisableRemindMonth(bDisabled)
' TransWeekDay(sDay)
' FirstRemindTime(sRemindMethod, dtBaseTime)
'********************************************************************************
'---------------------------------------------------------------
' VBScript 函数SetRemindData,根据参数sRemindMethod设置提醒界面
'---------------------------------------------------------------
sub SetRemindData(sRemindMethod)
Dim sHour, sMinute, sTime, sWeekday, sMonthday
' 从不提醒
if sRemindMethod = "" then
call SetNeverRemind()
document.all.Remind(0).checked = true
elseif Left(sRemindMethod,4) = "0104" then ' 提前几分钟提醒
call SetAheadMinutesRemind(Int(Right(sRemindMethod,4)))
document.all.Remind(1).checked = true
document.all.ahead_minute.value = Int(Right(sRemindMethod,4))
elseif Left(sRemindMethod,4) = "0108" then ' 提前几小时提醒
call SetAheadHoursRemind(Int(Right(sRemindMethod,4)))
document.all.Remind(2).checked = true
document.all.ahead_hour.value = Int(Right(sRemindMethod,4))
elseif Left(sRemindMethod,4) = "0116" then ' 提前几天提醒
call SetAheadDaysRemind(Int(Right(sRemindMethod,4)))
document.all.Remind(3).checked = true
document.all.ahead_day.value = Int(Right(sRemindMethod,4))
elseif Left(sRemindMethod,2) = "04" then ' 每天几点几分提醒
sHour = Left(Right(sRemindMethod,4),2)
sMinute = Right(sRemindMethod,2)
sTime = sHour & ":" & sMinute
call SetLoopDayRemind(sHour, sMinute)
document.all.Remind(4).checked = true
document.all.day_hour.value = sHour
document.all.day_minute.value = sMinute
elseif Left(sRemindMethod,2) = "08" then ' 每周几几点几分提醒
sHour = Left(Right(sRemindMethod,4),2)
sMinute = Right(sRemindMethod,2)
sTime = sHour & ":" & sMinute
sWeekday = Right(Left(sRemindMethod,4),2)
call SetLoopWeekRemind(sWeekday, sHour, sMinute)
document.all.Remind(5).checked = true
document.all.week_day.value = sWeekday
document.all.week_hour.value = sHour
document.all.week_minute.value = sMinute
elseif Left(sRemindMethod,2) = "16" then ' 每月几号几点几分提醒
sHour = Left(Right(sRemindMethod,4),2)
sMinute = Right(sRemindMethod,2)
sTime = sHour & ":" & sMinute
sMonthday = Int(Right(Left(sRemindMethod,4),2))
call SetLoopMonthRemind(sMonthday, sHour, sMinute)
document.all.Remind(6).checked = true
document.all.month_day.value = sMonthday
document.all.month_hour.value = sHour
document.all.month_minute.value = sMinute
else ' 如果以上几种情况都不满足,调用缺省的从不提醒
call SetNeverRemind()
document.all.Remind(0).checked = true
end if
end sub
'---------------------------------------------------------------
' 函数DisableRemindMonth()设置从不提醒
'---------------------------------------------------------------
sub SetNeverRemind()
call DisableRemind()
formTask.remind_type.value = ""
formTask.remind_method_desp.value = "从不提醒"
end sub
'---------------------------------------------------------------
' VBScript函数SetAheadMinutesRemind()设置一次性提醒 --> 提前 N 分钟提醒
'---------------------------------------------------------------
sub SetAheadMinutesRemind(nMinutes)
call DisableRemind()
call DisableRemindAheadMinute(false)
document.all.ahead_minute.focus()
formTask.remind_method.value = "010400" & nMinutes
formTask.remind_method_desp.value = "一次性提醒 --> 任务开始前提前 " & CInt(nMinutes) & " 分钟提醒"
end sub
'---------------------------------------------------------------
' VBScript函数SetAheadHoursRemind()设置一次性提醒 --> 提前 N 小时提醒
'---------------------------------------------------------------
sub SetAheadHoursRemind(nHours)
call DisableRemind()
call DisableRemindAheadHour(false)
document.all.ahead_hour.focus()
formTask.remind_method.value = "010800" & nHours
formTask.remind_method_desp.value = "一次性提醒 --> 任务开始前提前 " & CInt(nHours) & " 小时提醒"
end sub
'---------------------------------------------------------------
' VBScript函数SetAheadDaysRemind()设置一次性提醒 --> 提前 N 天提醒
'---------------------------------------------------------------
sub SetAheadDaysRemind(nDays)
call DisableRemind()
call DisableRemindAheadDay(false)
document.all.ahead_day.focus()
formTask.remind_method.value = "011600" & nDays
formTask.remind_method_desp.value = "一次性提醒 --> 任务开始前提前 " & CInt(nDays) & " 天提醒"
end sub
'---------------------------------------------------------------
' VBScript函数SetLoopDayRemind()设置循环提醒 --> 每天提醒
'---------------------------------------------------------------
sub SetLoopDayRemind(day_hour, day_minute)
call DisableRemind()
call DisableRemindDay(false)
formTask.remind_method.value = "0400" & day_hour & day_minute
formTask.remind_method_desp.value = "多次提醒 --> 每天 " & day_hour & ":" & day_minute & " 提醒"
end sub
'---------------------------------------------------------------
' VBScript函数SetLoopWeekRemind()设置循环提醒 --> 每周提醒
'---------------------------------------------------------------
sub SetLoopWeekRemind(week_day, week_hour, week_minute)
call DisableRemind()
call DisableRemindWeek(false)
formTask.remind_method.value = "08" & week_day & week_hour & week_minute
formTask.remind_method_desp.value = "多次提醒 --> 每周" & TransWeekDay(week_day) & " " & week_hour & ":" & week_minute & " 提醒"
end sub
'---------------------------------------------------------------
' VBScript函数SetLoopMonthRemind()设置循环提醒 --> 每月提醒
'---------------------------------------------------------------
sub SetLoopMonthRemind(month_day,month_hour,month_minute)
call DisableRemind()
call DisableRemindMonth(false)
formTask.remind_method.value = "16" & month_day & month_hour & month_minute
formTask.remind_method_desp.value = "多次提醒 --> 每月 " & CInt(month_day) & " 日 " & month_hour & ":" & month_minute & " 提醒"
end sub
'---------------------------------------------------------------
' 函数DisableRemind设置所有提醒相关控件的disabled属性
'---------------------------------------------------------------
sub DisableRemind()
call DisableRemindAhead(true)
call DisableRemindDay(true)
call DisableRemindWeek(true)
call DisableRemindMonth(true)
end sub
'---------------------------------------------------------------
' 函数DisableRemindAheadMinute()设置提前N分钟提醒相关控件的disabled属性
'---------------------------------------------------------------
sub DisableRemindAheadMinute(bDisabled)
document.all.ahead_minute.disabled = bDisabled
end sub
'---------------------------------------------------------------
' 函数DisableRemindAheadHour()设置提前N小时提醒相关控件的disabled属性
'---------------------------------------------------------------
sub DisableRemindAheadHour(bDisabled)
document.all.ahead_hour.disabled = bDisabled
end sub
'---------------------------------------------------------------
' 函数DisableRemindAheadDay()设置提前N天提醒相关控件的disabled属性
'---------------------------------------------------------------
sub DisableRemindAheadDay(bDisabled)
document.all.ahead_day.disabled = bDisabled
end sub
'---------------------------------------------------------------
' 函数DisableRemindAhead()设置提前提醒相关控件的disabled属性
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -