按键精灵添加脚本过期日期

    //获取网络时间
Private Function getWebDatetime() 
    Dim XmlHttp ,  objJs 
    Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
    XmlHttp.Open "POST", "https://www.baidu.com", False
    XmlHttp.send
    Set objJs = CreateObject("msscriptcontrol.scriptcontrol")
    objJs.Language = "jScript"
    getWebDatetime = objJs.Eval("var dt = new Date('" & XmlHttp.getResponseHeader("Date") & "');var date = [  [dt.getFullYear(), dt.getMonth() + 1, dt.getDate()].join('-'),  [dt.getHours(), dt.getMinutes(), dt.getSeconds()].join(':')].join(' ').replace(/(?=\b\d\b)/g, '0');date;")
    Set XmlHttp = Nothing
    Set objJs = Nothing
End Function
 
 
TracePrint  "距有效期还有:"&DateDiff("d", getWebDatetime(), "2018-02-01")
if DateDiff("d", getWebDatetime(), "2018-02-01")>0 Then  
Call fs()
Else 
MessageBox "软件已过期,请联系作者获取最新版本!"
End If
Sub fs()

//你的脚本

End Sub
Last modification:September 8th, 2018 at 09:14 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment