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
| Titre = "Alarme"
Set ws = CreateObject("wscript.Shell")
alarmDansMin = Trim ( InputBox( "Dans combien de minutes voulez-vous déclenchez l'alarme ?",Titre, "40") )
If alarmDansMin = "" Then Wscript.Quit
If Not IsNumeric(alarmDansMin) or alarmDansMin <= 1 Then
ws.Popup "Il faut Taper un Nombre strictement supérieur à 1 !","2",Titre,0+16 'Afficher un Popup durant 2 secondes puis quitte le script
Wscript.Quit
End if
sMessage = "Reste " & alarmDansMin/2 & " minutes !"
alarmDansmmsec = alarmDansMin*60*1000 'en millisecondes
alaramSecondes = alarmDansMin*60 'en secondes
nMinutes = alarmDansMin/2
WScript.sleep alarmDansmmsec/2
nSeconds = 0
sMessage = "<font color=red size=4><b>ALARME</b></font>"
' Open a chromeless window with message
with HTABox("lightBlue", 175, 450, 400,100)
.document.title = "Notification"
.msg.innerHTML = sMessage
do until .done.value or (nMinutes + nSeconds < 1)
.msg.innerHTML = sMessage & "<br>" & nMinutes & ":" & Right("0"&nSeconds, 2) _
& " restantes <br>"
wsh.sleep 1000 ' milliseconds
nSeconds = nSeconds - 1
if nSeconds < 0 then
if nMinutes > 0 then
nMinutes = nMinutes - 1
nSeconds = 59
end if
end if
loop
.done.value = true
.close
end with
ws.Popup "C'est FINI !","5",Titre,0+64 'Afficher un Popup durant 5 secondes puis quitte le script
'wscript.echo "process goes here ..."
' script ends here
Function HTABox(sBgColor, h, w, l, t)
Dim IE, HTA, sCmd, nRnd
randomize : nRnd = Int(1000000 * rnd)
sCmd = "mshta.exe ""javascript:{new " _
& "ActiveXObject(""InternetExplorer.Application"")" _
& ".PutProperty('" & nRnd & "',window);" _
& "window.resizeTo(" & w & "," & h & ");" _
& "window.moveTo(" & l & "," & t & ")}"""
Set WshShell = WScript.CreateObject("WScript.Shell")
with CreateObject("WScript.Shell")
.Run sCmd, 1, False
do until .AppActivate("javascript:{new ") : WSH.sleep 10 : loop
end with 'WSHShell
For Each IE In CreateObject("Shell.Application").windows
If IsObject(IE.GetProperty(nRnd)) Then
set HTABox = IE.GetProperty(nRnd)
IE.Quit
HTABox.document.title = "HTABox"
HTABox.document.write _
"<HTA:Application contextMenu=no border=thin " _
& "minimizebutton=no maximizebutton=no sysmenu=no />" _
& "<body scroll=no style='background-color:" _
& sBgColor & ";font:normal 10pt Arial;" _
& "border-Style:inset;border-Width:3px'" _
& "onbeforeunload='vbscript:if not done.value then " _
& "window.event.cancelBubble=true:" _
& "window.event.returnValue=false:" _
& "done.value=true:end if'>" _
& "<input type=hidden id=done value=false>" _
& "<center><span id=msg> </span><br>" _
& "<input type=button id=btn1 value=' OK ' "_
& "onclick=done.value=true><center></body>"
HTABox.btn1.focus
Exit Function
End If
Next
MsgBox "HTA window not found."
wsh.quit
End Function |