ayatest Posted February 16, 2015 Share Posted February 16, 2015 I saw, that some people experienced similar problems, but at the end I don't know what can/should I do and how. Here is a script: expandcollapse popup;Run("notepad.exe") ;Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) Local $sEnvVar = EnvGet("ProgramFiles(x86)") Run($sEnvVar & "\my folder1\my folder2\myapp.exe") Local $hWnd = WinWait("[CLASS:myapp.exe]", "", 10) Sleep(1000) Send("r") Sleep(2000) Send("r") while 1 activities2() wend func activities2() ; generate random (int) coordinates (and window sizes - min value is limited by autoit) within current screen resolution range. ; autoit debugger shows that coordinates are random per each loop cycle. Sleep(1000) $xwin = Random(0, @DeskTopWidth, 1) $ywin = Random(0, @DeskTopHeight, 1) $wwin = Random(0, @DeskTopWidth, 1) $hwin = Random(0, @DeskTopHeight, 1) WinMove($hWnd, "", $xwin, $ywin, $wwin, $hwin) endfunc When I switch to notepad - everything works fine, as expected. When I switch to myapp (a program under stress tests) - the app starts, receives test hotheys, but WinMove (move across the screen and resize) is not performed. Debugger shows no errors. App is standard Win program, resizable, in non-maximized state. How can I check why this is not working (I'm guessing tha WinMove isn't finding the window for some reason) and how can I fix it? This is 32bit app under 64bit win 8. functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general. Link to comment Share on other sites More sharing options...
JohnOne Posted February 16, 2015 Share Posted February 16, 2015 Does Winclose work on it, or any other Win* functions? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Valuater Posted February 16, 2015 Share Posted February 16, 2015 give each window a separate handle. You are using $hwnd for both 8) Link to comment Share on other sites More sharing options...
JohnOne Posted February 16, 2015 Share Posted February 16, 2015 (edited) One is commented out, I imagine been used for testing. The real test should be carried out after... Local $hWnd = WinWait("[CLASS:myapp.exe]", "", 10) To ensure winwait succeeded. Edited February 16, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jdelaney Posted February 16, 2015 Share Posted February 16, 2015 Use the spy tool and output the window's information. I doubt the class of your app includes .exe in it. Also, do error handling on the winwait (IsHwnd) to verify you are in fact grabbing the handle. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
ayatest Posted February 16, 2015 Author Share Posted February 16, 2015 (edited) One is commented out, I imagine been used for testing. The real test should be carried out after... Local $hWnd = WinWait("[CLASS:myapp.exe]", "", 10) To ensure winwait succeeded. Yes, notepad is commented out because it was for testing (interchangeably). WinClose with no effect. For class - I used what task manager shows in processes list. Was it wrong? Edited February 16, 2015 by ayatest functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 16, 2015 Moderators Share Posted February 16, 2015 As jdelaney points out, use the AutoIt Window Info Tool to get the class, located in the same directory where you installed AutoIt (AU3Info.exe) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Solution ayatest Posted February 17, 2015 Author Solution Share Posted February 17, 2015 (edited) Following some other suggestions, I did two things: 1) Added Opt("WinTitleMatchMode", 2) In the header, so that Win operator looks for partial string within app section 2) Changed WinWait("[CLASS:......... into WinWait("[TITLE:.......... (since title is unique for the app) Works like a charm. Quick references for other seekers: https://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm#WinTitleMatchMode https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm Any suggestions or comments to the method I used? (any limitations or problems to expect?) Edited February 17, 2015 by ayatest functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general. Link to comment Share on other sites More sharing options...
jdelaney Posted February 17, 2015 Share Posted February 17, 2015 Title is the default. It will work as you provided, or just as a string in the first param. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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