123456789101112131415161718192021222324252627 |
- import threading
- import time
- import win32api
- import log
- import win32con
- class ezcad(threading.Thread):
- def __init__(self, threadID, name, counter):
- threading.Thread.__init__(self)
- self.threadID = threadID
- self.name = name
- self.counter = counter
- self.log_file = log.log_file
- self.log_print = log.log_file
- self.filename = 'D:\Server\模板server.ezd'
- self.exename = 'EzCad2.exe'
- self.exepath = 'D:\Ezcad2.14.9(20160628新驱动)(1)\Ezcad2.14.9(20160628新驱动)'
- def run(self):
- try:
- win32api.ShellExecute(0, 'open', self.exename, self.filename, self.exepath, 1)
- time.sleep(20)
- # win32api.keybd_event(0x71, 0, 0, 0) # enter
- # time.sleep(0.1)
- # win32api.keybd_event(0x71, 0, win32con.KEYEVENTF_KEYUP, 0) # 释放按键
- except Exception as e:
- self.log_file.logger.error('打标机软件执行异常: {0}'.format(e), exc_info=True, stack_info=True)
|