aland Posted October 30, 2012 Share Posted October 30, 2012 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 More sharing options...
water Posted October 30, 2012 Share Posted October 30, 2012 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
aland Posted October 30, 2012 Author Share Posted October 30, 2012 I can tell because the program window is populated with a large TreeView (with vertical scroll) and the mouse icon changes from 'loading' to normal. Is it possible to detect these changes from AutoIt? Link to comment Share on other sites More sharing options...
water Posted October 30, 2012 Share Posted October 30, 2012 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
aland Posted October 30, 2012 Author Share Posted October 30, 2012 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 More sharing options...
water Posted October 30, 2012 Share Posted October 30, 2012 (edited) 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 & "|" & @error& @LF) $sResult = ControlTreeView($sTitle, "", 100, "GetText", $sID) ConsoleWrite($sResult & "|" & @error& @LF) $sResult = ControlTreeView($sTitle, "", 100, "GetItemCount", $sID) ConsoleWrite($sResult & "|" & @error& @LF)if you run a 64 bit OS and want to automate a 64 bit application you have to set "#AutoIt3Wrapper_UseX64=y". Edited October 30, 2012 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 - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now