ezcad.py 1016 B

123456789101112131415161718192021222324252627
  1. import threading
  2. import time
  3. import win32api
  4. import log
  5. import win32con
  6. class ezcad(threading.Thread):
  7. def __init__(self, threadID, name, counter):
  8. threading.Thread.__init__(self)
  9. self.threadID = threadID
  10. self.name = name
  11. self.counter = counter
  12. self.log_file = log.log_file
  13. self.log_print = log.log_file
  14. self.filename = 'D:\Server\模板server.ezd'
  15. self.exename = 'EzCad2.exe'
  16. self.exepath = 'D:\Ezcad2.14.9(20160628新驱动)(1)\Ezcad2.14.9(20160628新驱动)'
  17. def run(self):
  18. try:
  19. win32api.ShellExecute(0, 'open', self.exename, self.filename, self.exepath, 1)
  20. time.sleep(20)
  21. # win32api.keybd_event(0x71, 0, 0, 0) # enter
  22. # time.sleep(0.1)
  23. # win32api.keybd_event(0x71, 0, win32con.KEYEVENTF_KEYUP, 0) # 释放按键
  24. except Exception as e:
  25. self.log_file.logger.error('打标机软件执行异常: {0}'.format(e), exc_info=True, stack_info=True)