Hyperion Posted June 4, 2015 Share Posted June 4, 2015 Hello AutoIt forums, I'm trying to execute a keypress combination after a certain program is fully loaded, by which I mean that it isn't acting as frozen to any user inputs. But so far, I haven't been able to find a reliable solution to do this, not even WinWaitActive seemed to work properly on this one. I've tried to solve it by using the sleep function, but the program takes a longer time to start if it's being started for the first time, and I want the action to take place as soon as it is ready, without the need to imprecisely guess the time it takes to load.I thought of getting the memory usage of it and comparing it to a value in a while loop, but this didn't work as my attempt to get the memory by $Mem = ProcessGetStats("name") has failed, and it would also get a bit more complicated. If there is any reliable way to check whether a window is responding or not, I'd be glad to know it Link to comment Share on other sites More sharing options...
MikahS Posted June 4, 2015 Share Posted June 4, 2015 Have a look at _WinAPI_IsHungAppWindow Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Herb191 Posted June 4, 2015 Share Posted June 4, 2015 If there are some controls that get loaded last you can also do something like this:Run("notepad.exe") Do Sleep(250) Until ControlGetHandle("[CLASS:Notepad]", "", "Edit1") <> 0 ControlSetText("[CLASS:Notepad]", "", "Edit1", "It worked!")You can also try using functions like ControlClick and ControlSetText to see if the program is responding yet. Link to comment Share on other sites More sharing options...
Hyperion Posted June 4, 2015 Author Share Posted June 4, 2015 I've tried to use this, but it didn't work:Do Sleep(500) Until _WinAPI_IsHungAppWindow ("X3TC") == 0If I understood correctly, the $hWnd argument should be the window name, but it looks like I'm wrong.I cannot use the ControlGetHandle method, since it isn't a windows program but rather a game, which has no text input upon startup, I just have no idea how to properly use your method on that. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2015 Moderators Share Posted June 4, 2015 Hyperion,Welcome to the AutoIt forum.it isn't a windows program but rather a gameUnfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game interaction - and then you will understand why you will get no help and this thread will now be locked.See you soon with a legitimate question I hope.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts