Jump to content

Wait until windows finished loading


aland
 Share

Recommended Posts

Hi all,

I'm new to AutoIt and I'm trying to automate a program to load a (potentially large) file - I have written the automation without much problem, however the files I am loading can range between a few hundred KB to a couple of MB and thus the time it takes to finish loading ranges from a few seconds to, a minute or so.

WinWaitActive will return once the program has opened, is there a similar 'wait' command for when a program is ready/idle?

Of course, I could sleep for a few seconds in an effort to catch the 'worst case' but I'm looking for a more elegant solution :)

The window title does change when the file is opened, however there is still a delay between this change and the program truely being ready relative to the file size.

The program I'm scripting for is BEncode Editor which I believe is itself written in AutoIt (whether that makes a difference or not).

Cheers

Link to comment
Share on other sites

Welcome to AutoIt and the forum!

How do YOU know when the file has loaded? Is there a text in the status bar ("file loaded") or some other change so you can se that the file has loaded?

If you can manually determine that the file has loaded AutoIt will do as well.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Check the TreeView control. If the control is populated with data, then your script can go on processing.

Use The AutoIt Window Info Tool to get the ControlID of the TreeView and try function ControlTreeView.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Really appreciate your help with this. I've put a long sleep so I can be sure the data is loaded before running the below code, but I'm not able to get it to work. In place of "[iD:51]" I've tried [CLASS:Static; INSTANCE:11], [CLASS:Static] and 51, all return value of 0 (no error).

Local $treeview = ControlTreeView("BEncode Editor", "", "[ID:51]", "GetItemCount", "#0")
If @error Then
     MsgBox(4096, "Error", "ControlTreeView error")
EndIf
MsgBox(4096, "Control treeview output", $treeview)

Below is the summary from AutoIt Window Info -

>>>> Window <<<<
Title: resume.dat - BEncode Editor
Class: AutoIt v3 GUI
Position: 733, 345
Size: 466, 363
Style: 0x14CF0000
ExStyle: 0x00000110
Handle: 0x001C09D0
>>>> Control <<<<
Class: Static
Instance: 11
ClassnameNN: Static11
Name:
Advanced (Class): [CLASS:Static; INSTANCE:11]
ID: 51
Text:
Position: -5, -45
Size: 460, 355
ControlClick Coords: 163, 85
Style: 0x5000010E
ExStyle: 0x00000000
Handle: 0x00220B82
>>>> Mouse <<<<
Position: 899, 435
Cursor ID: 0
Color: 0xFFFFFF
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
>>>> Hidden Text <<<<
Link to comment
Share on other sites

The following example will list the 3rd drive in the WIndows Explorer for Desktop -> Computer:

#AutoIt3Wrapper_UseX64=y
#include <array.au3>
$sTitle = "[Class:CabinetWClass]"
$sID = "Desktop|#0|#2"

$sResult = ControlTreeView($sTitle, "", 100, "Select", $sID)
ConsoleWrite($sResult &amp; "|" &amp; @error&amp; @LF)
$sResult = ControlTreeView($sTitle, "", 100, "GetText", $sID)
ConsoleWrite($sResult &amp; "|" &amp; @error&amp; @LF)
$sResult = ControlTreeView($sTitle, "", 100, "GetItemCount", $sID)
ConsoleWrite($sResult &amp; "|" &amp; @error&amp; @LF)
if you run a 64 bit OS and want to automate a 64 bit application you have to set "#AutoIt3Wrapper_UseX64=y". Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...