BussinessLogic.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. from conf import Config
  2. from pywinauto.application import Application
  3. from logger import log
  4. import time
  5. import os
  6. import datetime
  7. import time
  8. class business_logic:
  9. def convert_files(self,file):
  10. _config = Config()
  11. backslash = "\\"
  12. app_path = _config.Moved_Path+backslash+file
  13. #print(app_path)
  14. os.startfile(app_path)
  15. time.sleep(50)
  16. print("Sleep End!!!")
  17. app = Application().connect(path=r"C:\Program Files\TechSmith\Camtasia 9\CamtasiaStudio.exe")
  18. #for TRIAL
  19. if _config.Trial == 'YES':
  20. #app.Window_(best_match='Dialog', top_level_only=True).ChildWindow(best_match='Finish').SetFocus()
  21. app.Window_(best_match='Dialog', top_level_only=True).ChildWindow(best_match='Finish').Click()
  22. #end for TRIAL
  23. child_elements = app[u'Camtasia 9']
  24. #remark
  25. child_elements.ClickInput(coords=(_config.Share_Btn_X, _config.Share_Btn_Y))
  26. child_elements.TypeKeys("{DOWN}")
  27. child_elements.TypeKeys("{ENTER}")
  28. #time.sleep(10)
  29. #for TRIAL
  30. if _config.Trial == 'YES':
  31. child_elements.Wait('visible',timeout=20)
  32. child_elements.ClickInput(coords=(_config.Water_Mark_Btn_X, _config.Water_Mark_Btn_Y))
  33. #end for TRIAL
  34. for i in range(_config.Dialogs):
  35. #for no_dialogs in _config.Dialogs:
  36. #time.sleep(2)
  37. child_elements.Wait('visible',timeout=20)
  38. app.Window_(best_match='Dialog', top_level_only=True).ChildWindow(best_match='Next').Click()
  39. #app.Window_(best_match='Dialog', top_level_only=True).PrintControlIdentifiers()
  40. app.Window_(best_match='Dialog', top_level_only=True).ChildWindow(title="Untitled Project",class_name="Edit").SetText(time.time())
  41. app.Window_(best_match='Dialog', top_level_only=True).ChildWindow(best_match='Finish').Click()
  42. time.sleep(2)
  43. #child_elements.Wait('visible',timeout=20)
  44. app.kill_()
  45. time.sleep(10)
  46. print("Rendering Succcessful")
  47. #Finish rendering