import sys
#module for work with windows (32bit)
import win32gui
txt=''
time1=time.time()
#times dictionary
appdict=dict()
while True:
#pause (it's influence to accuracy)
time.sleep(5)
#title of the current window
newtxt = win32gui.GetWindowText(win32gu
#if window was changed than update time of beginning work with other window
if txt!=newtxt:
time2=time.time()
#add previous time to dict
if appdict.get(txt)!=None:
appdict[txt]=appdict[txt]+roun
else:
appdict[txt]=round(time2,0)-ro
txt=newtxt
time1=time.time()
f=open('timerep.csv', 'w')
csvwr = csv.writer(f, delimiter=';',lineterminator='
#We write only window that summary time over 5 minutes (Other window is non-influential).
for i in appdict.items():
if i[1]>=300:
csvwr.writerow(i)
f.close()
Комментариев нет:
Отправить комментарий