MemphiZ Posted March 30, 2011 Share Posted March 30, 2011 (edited) Hi all, I've been watching AutoItScript.com for a long time now and I learned much about AutoIt from this community! Thanks to everybody posting his scripts! I thought its time to set up an account because there is one thing bugging me for hours now and I can't find a solution. Question: If I "Send("!{ENTER}")" to a window and it switches to fullscreen how can I detect when this switching is done? The Scenario: I want to benchmark an application using FRAPS. Unfortunately most applications don't allow "PixelGetColor" in fullscreen mode. Therefore I'm starting the application windowed and having a while loop running which is detecting a color change from black to any color using this loop: $dimensions = WinGetPos("The Window Title") $color = PixelGetColor($dimensions[0] + 100, $dimensions[1] + 100) While $color = 0 $color = PixelGetColor($dimensions[0] + 100, $dimensions[1] + 100) Sleep(250) WEnd When the script exits this loop I know that I can "Send" the Hotkey for FRAPS to start measuring. But before I do that I have to "Send" ALT+ENTER to go fullscreen. The Problem: If I send ALT+ENTER followed by the Hotkey I mostly get a minimum value of 0 frames in the log because FRAPS started measuring to early as the switching was not finished yet. Sleeping for 1 or 2 seconds is not a solution as I have to make sure that I start measuring on multiple systems at the same point. The time taken to switch to fullscreen varies based on system speed. Any help is appreciated! So long, MemphiZ Edited March 30, 2011 by MemphiZ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 30, 2011 Moderators Share Posted March 30, 2011 MemphiZ, I would just check if the active window fills the screen like this: While 1 ; Resolution might be changed so check each time $iW = @DesktopWidth $iH = @DesktopHeight ; Get GUI size $aPos = WinGetPos("[ACTIVE]") ; Just for testing ConsoleWrite($aPos[2] & " - " & @DesktopWidth & @CRLF) ConsoleWrite($aPos[3] & " - " & @DesktopHeight & @CRLF) ; Does the active GUI fill the screen If $aPos[2] >= $iW And $aPos[3] >= $iH Then SplashTextOn("Active", "FullScreen") ConsoleWrite("FullScreen" & @CRLF) Else SplashTextOn("Active", "Not FullScreen") ConsoleWrite("Not FullScreen" & @CRLF) EndIf ; Allow splash to be seen Sleep(2000) SplashOff() ; Set this to a suitable value to check at intervals Sleep(5000) WEnd I hope this helps. M23 kisstom 1 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...
MemphiZ Posted March 31, 2011 Author Share Posted March 31, 2011 Melba32, I thought about this option already but (to be honest) I didn't try it because I thought the window might have the size already even if its not really re-initialized and/or drawing already but luckily I was wrong. Thank you very much for your help! 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