nf67 1 Posted April 11, 2010 (edited) Hi, since you can't WinMove() minimized windows I figured I'd restore the window first. However, when checking if the window is minimized, this doesn't return "true". Please take a look at the example below: HotKeySet("h","Hide") HotKeySet("s","Show") ;Activate a window, press "h", then press "s" again. $Window = "[active]" While 1 WEnd Func Hide() $Window = WinGetTitle("[active]") MsgBox(0,$Window,"This window will now be hidden, try getting it back with ""s"".") WinSetState("[active]","",@SW_MINIMIZE) EndFunc Func Show() If WinGetState($Window) = 16 Then ; <-- Now this doesn't work :-/ WinSetState($Window,"",@SW_RESTORE) EndIf WinMove($Window,"",0,0) ;Works fine, but you'll have to restore the window first, since the IF doesn't work... EndFunc Any suggestions on how to do this? Thanks in advance. Edited April 11, 2010 by nf67 Share this post Link to post Share on other sites
Melba23 3,456 Posted April 11, 2010 nf67,From the Help file for WinGetState:"Multiple values are added together so use BitAND() to examine the part you are interested in"So let us try that:HotKeySet("h","Hide") HotKeySet("s","Show") ;Activate a window, press "h", then press "s" again. $Window = "[active]" While 1 WEnd Func Hide() $Window = WinGetTitle("[active]") MsgBox(0,$Window,"This window will now be hidden, try getting it back with ""s"".") WinSetState("[active]","",@SW_MINIMIZE) EndFunc Func Show() If BitAnd(WinGetState($Window), 16) = 16 Then ; <-- Now this does work!!!!!!!!!!!!!!!!!! WinSetState($Window,"",@SW_RESTORE) EndIf WinMove($Window,"",0,0) ;Works fine, but you'll have to restore the window first, since the IF doesn't work... EndFuncAnd it works. 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 Share this post Link to post Share on other sites
nf67 1 Posted April 11, 2010 Thank you Melba23, I've never quite understood BitAND to be honest (due to its undescriptive name) , thanks for providing an example. Share this post Link to post Share on other sites
Melba23 3,456 Posted April 11, 2010 nf67, I've never quite understood BitANDMany of the styles you use in AutoIt are "bit-based" so it si quite important to understand BitAND and BitOR. Think of BitAND this way - each of the bits is a flag and you need a mask to see if the correct flag is set. Here is a (random) number at the bit level: 128 64 32 16 8 4 2 1 0 0 1 1 0 0 0 1 = 32 + 16 + 1 = 49 You can see how it does not return 16 even though the "16" "flag" is set. What BitAND does is to put a mask over the number and check the specific bit: 128 64 32 16 8 4 2 1 0 0 1 1 0 0 0 1 = 32 + 16 + 1 = 49 0 0 0 1 0 0 0 0 - Mask of 16 BitAND means only count where BOTH bits are 1, so we get 0 0 0 1 0 0 0 0 = 16!!!! The same sort of logic works when you add styles using BitOR. Imgine you have 2 styles both of which set the same bit (among others of course!) Style 1 = 00001010 - set bits 4 & 2 Style 2 = 00000010 - set bit 2 Add = 00001100 - Oops, bits 4 & 3 now set. BitOr = 00001010 - OK, bits 4 & 2 still set I hope that makes it crystal clear. 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 Share this post Link to post Share on other sites
Aktonius 2 Posted December 28, 2011 Melba23 you rock again! Share this post Link to post Share on other sites
somdcomputerguy 103 Posted December 28, 2011 Melba23 you rock again! It has been shown that the foundation of AutoItland is heavily striated with M23rock.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Share this post Link to post Share on other sites
Melba23 3,456 Posted December 28, 2011 somdcomputerguy,It has been shown that the foundation of AutoItland is heavily striated with M23rockThanks for the compliment but I would say that the bedrock was laid down over the years by the various Devs. I will however freely admit to quarrying it quite heavily - and giving geology classes on many occasions! 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 Share this post Link to post Share on other sites