ezcad.py 1021 B

12345678910111213141516171819202122232425262728293031
  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 = 'E:\Server\模板server.ezd'
  15. self.exename = 'EzCad2.exe'
  16. self.exepath = 'C:\Ezcad2.14.5(20160407)_公司logo\Ezcad2.14.5(20160407)_公司logo'
  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)