Skip to content

Commit

Permalink
Merge pull request GuanYixuan#34 from chi1st/main
Browse files Browse the repository at this point in the history
Fix: The close button cannot be located after export.
  • Loading branch information
GuanYixuan authored Jan 8, 2025
2 parents 409c35b + 47cc6c7 commit c721b14
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pyJianYingDraft/jianying_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ def export_draft(self, draft_name: str, output_dir: Optional[str] = None, timeou
self.get_window()
if self.app_status != "pre_export": continue

export_window = self.app.WindowControl(searchDepth=1, Name="JianyingPro")
if export_window.Exists(0):
close_btn = export_window.ButtonControl(Name="关闭")
if close_btn.Exists(1):
close_btn.Click(simulateMove=False)
succeed_close_btn = self.app.TextControl(searchDepth=2, Compare=self.__export_succeed_close_btn_cmp)
if succeed_close_btn.Exists(0):
succeed_close_btn.Click(simulateMove=False)
break

if time.time() - st > timeout:
Expand Down Expand Up @@ -169,3 +167,10 @@ def __export_path_cmp(control: uia.TextControl, depth: int) -> bool:
return False
full_desc: str = control.GetPropertyValue(30159).lower()
return "ExportPath".lower() in full_desc

@staticmethod
def __export_succeed_close_btn_cmp(control: uia.TextControl, depth: int) -> bool:
if depth != 2:
return False
full_desc: str = control.GetPropertyValue(30159).lower()
return "ExportSucceedCloseBtn".lower() in full_desc

0 comments on commit c721b14

Please sign in to comment.