Terenz Posted November 21, 2013 Share Posted November 21, 2013 (edited) Hello guys, the "Advanced Window Descriptions" named "Active" can be used in many function, WinGetText, WinGetTitle and other If i put one of it in a While-WEnd loop, how i can have ex. a MsgBox only when ACTIVE window change and not everytime? Thanks Edited November 21, 2013 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted November 21, 2013 Moderators Solution Share Posted November 21, 2013 Terenz,Just compare the current return from WinGetHandle with the previous return - if they are different then show your MsgBox. 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...
Terenz Posted November 21, 2013 Author Share Posted November 21, 2013 Hi Melba, so i need to do something like: While 1 $OldHandle = WinGetHandle("[ACTIVE]") If $OldHandle <> WinGetHandle("[ACTIVE]") Then etc. WEnd Is correct? Sorry but i can't make the script in the codebox Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 21, 2013 Moderators Share Posted November 21, 2013 (edited) Terenz,Close: #include <Constants.au3> ; Get original handle $hOldHandle = WinGetHandle("[ACTIVE]") While 1 ; Get current handle $hCurrHandle = WinGetHandle("[ACTIVE]") ; If changed If $hOldHandle <> $hCurrHandle Then ; Announce it MsgBox($MB_SYSTEMMODAL, "Hi", "New active") ; Reactivate the window after the MsgBox closes WinActivate($hCurrHandle) ; And wait for the next change $hOldHandle = $hCurrHandle EndIf ; Save the CPU Sleep(10) WEndM23 Edited November 21, 2013 by Melba23 Typo 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...
Terenz Posted November 21, 2013 Author Share Posted November 21, 2013 Ohh, understood. Thanks Nothing is so strong as gentleness. Nothing is so gentle as real strength 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