Script d'expiration Hackoofr

Bonjour à tous !

Je me permets de revenir vers vous, au sujet d’un script qui a été créé il y a un petit moment.

Le script permet de signaler si un programme est expiré ou pas.
En un sens le script fonctionne au moment où la date est expirer une fenêtre s’affiche et au bout de 10 seconde s’en va cela est parfait…mais si la date n’est pas expirer une fenêtre s’affiche avec rien dedans et elle ne part pas comme la fenêtre d’expiration. Donc ma question est-il possible que la fenêtre affiche le temps restant avant expiration et que la fenêtre s’en va comme l’autre au bout de 10 seconde. Dans ma modification j’ai ajouté un bout de code qui permet de faire parler mon PC…

cordialement...

Code hta : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html>
<head>
<TITLE>Expiration_Date</TITLE>  
<HTA:APPLICATION  
APPLICATIONNAME="Expiration_Date"  
VERSION="1.0.0.0"  
BORDER="none"  
INNERBORDER="no"  
CAPTION="no"  
MAXIMIZEBUTTON="no"  
MINIMIZEBUTTON="no"  
ICON="NO"  
SCROLL="no"  
SCROLLFLAT="yes"  
SINGLEINSTANCE="yes"  
WINDOWSTATE="normal"  
SHOWINTASKBAR="no"  
CONTEXTMENU="Yes" 
SYSMENU="Yes" 
SELECTION="no"/>
<SCRIPT Language="VBScript">
SEC="0"
MIN="0"
HRS="0"
Sub CenterWindow(x,y)
        window.resizeTo x, y
        iLeft = window.screen.availWidth/2 - x/2
        itop = window.screen.availHeight/2 - y/2
        window.moveTo ileft, itop
End Sub
 
Sub Window_onLoad
   CenterWindow 500,200
   Expiration_Date()
End Sub 
 
Sub Expiration_Date()
Expiration = Cdate("30/09/2020")
DateSysteme = Date 
If (DateSysteme < Expiration) Then
    dim xHttp: Set xHttp = createobject("MSXML2.ServerXMLHTTP")
    xHttp.Open "GET", "http://127.0.0.1:8888/?tts=le programme est expirer", False
    xHttp.setOption 2, 13056
    xHttp.Send
Else
    IdTimer=Window.SetInterval("blink(bl)",500)
    Call Timer
End If
End Sub
 
SUB TIMER()
IF SEC<>"59" THEN
SEC=SEC+1
If SEC = "10" Then Window.Close
ELSE
SEC="0"
IF MIN<>"59" THEN
MIN=MIN+1
ELSE
MIN="0"
HRS=HRS+1
END IF
END IF
IF LEN(SEC)="1" THEN SEC="0"&SEC
IF LEN(MIN)="1" THEN MIN="0"&MIN
IF LEN(HRS)="1" THEN HRS="0"&HRS
temps.InnerHTML="<TEXT>"&HRS&":"&MIN&":"&SEC&"</TEXT>"
Window.ClearTimeOut(IdTimer)
IdTimer=Window.SetTimeOut("TIMER()",1000,"VBScript")
END SUB
 
Function blink(Obj)
if Obj.style.visibility = "visible" Then
Obj.style.visibility = "hidden"
else
Obj.style.visibility = "visible"
end if
End Function
</script>
</head>
<BODY BGCOLOR="#000000" TOPMARGIN="0" LEFTMARGIN="0">
<center><TABLE WIDTH="200" BORDER="1" BORDERCOLOR="#000000" BGCOLOR="#BBBBFF" CELLPADDING="2" CELLSPACING="1">
<TR BGCOLOR="#346E99"><TD COLSPAN="2"><CENTER><FONT COLOR="#FFFFFF" SIZE="+1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">-= T I M E R =-</FONT></CENTER></TD></TR>
<TR><TD WIDTH="150"><center><TEXT>Temps Restant</TEXT></center></TD><TD WIDTH="150"><center><SPAN ID=temps></SPAN></center></TD></TR></TABLE>
<br><br>
<div id="bl" style="visibility:hidden"><font size=+2 color=red><center>ATTENTION le programme vient d'etre expire !!!</center></font></div>
</script>
</body>
</html>