def read_time(self): data = win32api.GetSystemTime() hours = int(data[4]) minutes = int(data[5]) seconds = int(data[6]) self.registers_values[2] = hours * 256 + minutes temp_l = self.registers_values[3] % 256 self.registers_values[3] = seconds * 256 + temp_l
def read_date(self): data = win32api.GetSystemTime() print(data) year_high = int(data[0] // 100) year_low = int(data[0] % 100) month = int(data[1]) day = int(data[3]) self.registers_values[2] = year_high * 256 + year_low self.registers_values[3] = month * 256 + day
def changeSystemTime(self): tt = win32api.GetSystemTime() print "System time before change:" self.printTime(tt) hour = tt[4] minute = tt[5] second = tt[6] - 1 if (second < 0): minute = minute + 1 if (minute > 59): minute = 0 hour = hour + 1 if (hour > 23): hour = 1 second = 59 win32api.SetSystemTime(tt[0], tt[1], tt[2], tt[3], hour, minute, second, random.randint(0, 999)) print "System time after change:" self.printTime(win32api.GetSystemTime())
def incrementSystemTime(secs): current = win.GetSystemTime() # win.getSystemTime() returns a tuple with day of week as the 3rd element of the tuple, which is extraneous # for the python datetime package T = datetime.datetime(*(current[:2] + current[3:])) delta = datetime.timedelta(0, secs) T_prime = T + delta day_of_week = T_prime.isocalendar()[2] T_tuple = tuple(T_prime.timetuple()) # Create a new tuple to use to set windows time from the Python datetime objects future = T_tuple[:2] + (day_of_week, ) + T_tuple[2:7] T_new = win.SetSystemTime(*future) return T_new
def GeneralInfo(): global host, fv, srcfile host = win32api.GetComputerName() srcfile = "C:\\" + host fv = open(srcfile, 'w') fv.write("Machine NAME : ") fv.write(host) fv.write('\n') fv.write("the machine is joined to the domain : ") fv.write(str(win32api.GetDomainName())) fv.write('\n') fv.write("these settings were logged for user : "******"System Time is : ") fv.write(str(win32api.GetSystemTime())) fv.write('\n\n\n')
def systemTime(self): return win32api.GetSystemTime()
import win32api import win32gui import win32con from win32con import KEYEVENTF_KEYUP import win32ui import pywintypes from selenium import webdriver import time # driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe") # driver.get('http://www.baidu.com') # print(win32gui.FindWindow(driver, None)) # time.sleep(1) # title = driver.title # print(win32ui.GetActiveWindow()) win32api.keybd_event(18,0,0,0) time.sleep(0.5) win32api.keybd_event(9,0,0,0) time.sleep(0.5) win32api.keybd_event(9,0,KEYEVENTF_KEYUP,0) time.sleep(0.5) win32api.keybd_event(18,0,KEYEVENTF_KEYUP,0) time.sleep(0.5) print(win32gui.FindWindow("Notepad", None) ) print(win32api.GetSystemTime()) # print(win32gui.IsWindow(win32ui.GetForegroundWindow()))
""" Crush Crush连续快进时间 @author: hikaru email: [email protected] 如有问题或建议请联系 """ import datetime import win32api import time import math def set_system_time(year, month, day, hour, minute, second): win32api.SetSystemTime(year, month, datetime.date(year, month, day).weekday(), day, hour, minute, second, 0) if __name__ == "__main__": now = win32api.GetSystemTime() process_time = 0 for i in range(0, 1): set_system_time(2005, 1, 1, 0, 0, 0) time.sleep(0.2) set_system_time(2035, 1, 1, 0, 0, 0) time.sleep(0.2) process_time += 0.4 set_system_time(now[0], now[1], now[3], now[4], now[5], now[6] + int(math.ceil(process_time)))
print(api.GetDomainName()) print(api.GetEnvironmentVariable('path')) print(api.GetFileAttributes('.')) print(api.GetFileVersionInfo('C:\\windows\\system32\\cmd.exe', "\\")) print(api.GetFullPathName('.')) print(api.GetLocalTime()) print(api.GetLogicalDriveStrings().replace('\x00', ' ')) print(api.GetLogicalDrives()) print(api.GetLongPathName('C:')) print(api.GetModuleFileName(0)) print(api.GetNativeSystemInfo()) print(hex(api.GetSysColor(con.COLOR_WINDOW))) print(api.GetSystemDirectory()) print(api.GetSystemInfo()) print(api.GetSystemMetrics(con.SM_CXSCREEN)) print(api.GetSystemTime()) print(api.GetTickCount()) # print(api.GetTimeZoneInformation()) print(api.GetUserDefaultLangID()) print(api.GetUserName()) print(api.GetVersion()) print(api.GetVolumeInformation('C:')) print(api.GetWindowsDirectory()) print(api.GlobalMemoryStatus()) print(api.MessageBeep()) print(api.MessageBox(0, 'hello', 'world', con.MB_OK)) size = api.RegQueryInfoKey(con.HKEY_LOCAL_MACHINE) print(size) for i in range(size[0]): print(api.RegEnumKey(con.HKEY_LOCAL_MACHINE, i)) try:
def alt_get_utc_datetime(): t = win32api.GetSystemTime() return datetime.datetime(t[0], t[1], t[3], t[4], t[5], t[6], t[7] * 1000)