Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The navigation window and the main window have the same title text and class name.
#1
I am using LA to operate CapCut to open a draft and export a video. The following code executes successfully, but I encountered a few issues:
  1. After launching CapCut, the navigation window first appears (as shown in Figure 1). When selecting a specific draft, the main window opens (as shown in Figure 2). However, something strange happens—the navigation window does not seem to close, and both the navigation window and the main window have identical title text and class names. Because of this, in the code below, I cannot use something like
    w1.WaitForClosed(1); and instead had to use a direct delay.
  2. The Export button is located in the upper-right corner of the main window (Figure 3). If the opened draft contains many resources, this button appears with a delay. Before all resources are loaded, the button is also unclickable. Additionally, the Export Dialog sometimes appears with a delay. The Export button at the bottom right of the dialog (Figure 4) is also unclickable until the entire dialog is fully rendered. Neither of these buttons provide state information, so I cannot use something like e3.WaitFor(30, t => !t.IsDisabled); to wait for them.

    Recently, I have been reviewing some FlaUI code samples. When handling these cases, they often use techniques like:
     
    Code:
    Copy      Help
    Wait.UntilInputIsProcessed();
    var modalWindows = Retry.WhileEmpty(() => window.ModalWindows, TimeSpan.FromSeconds(1)).Result;
    If I don't want to use direct delays, is there a better solution?
    Thanks in advance for any suggestions and help!
Code:
Copy      Help
// script "jytest.cs"
//.
script.setup(trayIcon: true, sleepExit: true);
//..

var w1 = wnd.findOrRun("剪映专业版", "Qt622QWindowIcon", run: () => { run.it(folders.LocalAppData + @"JianyingPro\Apps\5.9.0.11632\JianyingPro.exe"/*, "--src1"*/); });
var e1 = w1.Elm["STATICTEXT", prop: "desc=HomePageDraftTitle:3月21日", flags: EFFlags.UIA].Find(10);
e1.Parent.MouseClick();
//w1.WaitForClosed(1);

10.s();

var w2 = wnd.find(1, "剪映专业版", "Qt622QWindowIcon");
var e2 = w2.Elm["STATICTEXT", prop: "desc=MainWindowTitleBarExportBtn", flags: EFFlags.UIA].Find(6);

//e2.WaitFor(30, t => !t.IsDisabled);

e2.MouseClick();

10.s();

var w3 = wnd.find(1, "导出", "Qt622QWindowIcon");
var e3 = w3.Elm["STATICTEXT", prop: "desc=ExportOkBtn", flags: EFFlags.UIA].Find(6);

//e3.WaitFor(30, t => !t.IsDisabled);

e3.MouseClick();

FLAUI code:
https://github.com/FlaUI/FlaUI/blob/mast...ods.cs#L67


Messages In This Thread
The navigation window and the main window have the same title text and class name. - by Davider - 03-21-2025, 03:03 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)