Salut,

Voici ce que j'ai écrit, il fonctionne sous Windows7 avec Jaws14...
(pas de let, then).
une pression sur le raccourci on obtient le temps depuis lequel la machine a été allumée, une double pression, l'heure d'allumage et le jour.
J.-C.

String Function ConvertSecondToTime (int iTotal)
var int j, int h, int m, int s

j = iTotal /86400;ça, c'est le nombre de secondes dans un jour
h = (iTotal-j*86400)/3600
m = (iTotal-(j*86400+h*3600))/60
s = (iTotal-(j*86400+h*3600 + m*60))

if j == 0 && h == 0 && m == 0
iTotal = s + " seconde"
elif j == 0 && h == 0 && s == 0
iTotal = m + " minute"
elif j == 0 && m == 0 && s == 0
iTotal = h + " heure "

elif j == 0 && s == 0
iTotal = h + " heure " + m + " minute "
elif j == 0 && h == 0
iTotal = m + " minute " + s + " seconde"
elif j == 0
iTotal = h + " heure " + m + " minute " + s + " seconde"
elif h == 0
iTotal = j + " jour " + m + " minute " + s + " seconde"
elif m == 0
iTotal = j + " jour " + h + " heure " + s + " seconde"
elif s == 0
iTotal = j + " jour " + h + " heure " + m + " minute "

else
iTotal = j + " jour " + h + " heure " + m + " minute " + "et" + s + " seconde"
endif
return iTotal
EndFunction

Int Function ConvertTimeToSecond (string sTemp)
var int nbs, string h, string m, string s
h = StringSegment (sTemp, ":", 1)
m = StringSegment (sTemp, ":", 2)
s = StringSegment (sTemp, ":", 3)
nbs = StringToInt(h)* 3600 + StringToInt(m) * 60 + StringToInt(s)
return nbs
EndFunction

String Function Quand (int jour, int HeureActuelle, int HeureDallumage)
if jour == 0 && HeureActuelle> HeureDallumage 
return ("aujourd'hui !")
elif jour == 0 && HeureActuelle < heureDallumage 
return ("hier")
elif jour == 1  && HeureActuelle > heureDallumage 
return ("hier")
elif jour == 1 && HeureActuelle < heureDallumage 
return ("Avan hier")
elif jour == 2  && HeureActuelle > heureDallumage 
return("Avant hier")
endif
EndFunction

Script QuelDate ()
;AltCtrlT
var int i, int i2, int hd, string hA, int ihA, int j, string qj ; détermine 
quel jour de la semaine
let i = GetTickCount ()/1000 ;176400
let i2 = i%86400
j = i / 86400
hA = SysGetTime ("HH:mm:ss") ;"05:00:00" 
ihA = ConvertTimeToSecond(hA)
;if IsSameScript () == 2
;saystring("la machine tourne depuis")
;sayInteger(i)
;sayString("heure actuelle")
;sayInteger(ihA)
;saystring("heure d'allumage")
;hd = ihA - i2
;if hd < 0 then
;hd = hd + ( 86400)
;endif
;sayInteger (hd)
if IsSameScript ()
delay (1)
saystring("elle a été allumée à")
hd = ihA - i2
if hd < 0 then
hd = hd + ( 86400)
endif
if hd > iHA
let j = j+1
endif
sayString (ConvertSecondToTime (hd))
saystring (Quand (i/86400, ihA, hd))

saystring(QuelJour (j));, iHa))

else
Delay (2)
saystring("cette machine tourne depuis")
SayString(ConvertSecondToTime (i))
endif
EndScript

Répondre à