Jump to content

Minimize/RestoreAllBut


OldCoder
 Share

Recommended Posts

Just a simple script that Minimizes and Restores all windows except the one you define. Of course, it would be easy enough to rewrite this to include a delimited list of exceptions, but I'll leave that to you.

;    **** EXAMPLE ****

; MinimizeAllBut("Notepad")
; Sleep(1000)
; RestoreAllBut("Notepad")
; Exit


; Minimizes All Windows Except Defined Window
;
;   $mab_title =    Windows Title you wish not to Minimize
;           *(This is compared using StringInStr, so
;             use caution when defining title. A
;             too general title may exempt other
;             windows you want to be minimized)

Func MinimizeAllBut($mab_title)

$mab_var = WinList()
Global $mab_winstate[$mab_var[0][0]+1][3]
$mab_winstate[0][0]=$mab_var[0][0]

For $mab_i = 1 to $mab_var[0][0]

    $mab_winstate[$mab_i][1]=$mab_var[$mab_i][0]
    $mab_winstate[$mab_i][2]=WinGetState($mab_var[$mab_i][1])

    If $mab_var[$mab_i][0] <> "" AND BitAnd(WinGetState($mab_var[$mab_i][1]), 2) AND BitAnd(WinGetState($mab_var[$mab_i][1]), 16)=0 AND BitAnd(WinGetState($mab_var[$mab_i][1]), 8) AND StringInStr($mab_var[$mab_i][0], $mab_title)=0 Then WinSetState($mab_var[$mab_i][0], "", @SW_MINIMIZE)
Next

EndFunc


Func RestoreAllBut($mab_title)

For $mab_i = 1 to $mab_winstate[0][0]

    If $mab_winstate[$mab_i][1] <> "" AND BitAnd($mab_winstate[$mab_i][2], 16)=0  AND BitAnd($mab_winstate[$mab_i][2], 8) AND StringInStr($mab_winstate[$mab_i][1], $mab_title)=0 Then WinSetState($mab_winstate[$mab_i][1], "", @SW_RESTORE)
Next

EndFunc

Hope this comes in handy for someone. Cheers.

Edited by OldCoder
"Intelligence is the ability to adapt to change."                                      - Stephen Hawking                                        "...not the ability to exploit others."                                                  - OldCoder
Link to comment
Share on other sites

I had a coomador 64. My great plan was my wife and I were having twins and I was designing a banner maker so I could put a great big banner across my garage door to welcome home my new twins.... well after deciding "how" I was going to accomplish this, I was working hard on creating all the letters and my neighbor said I could buy a program for $19.00 at the store. This banner program had just came out.

End of story, I bought it and the sign was there to welcome home my beautiful twins.

8)

NEWHeader1.png

Link to comment
Share on other sites

I had a coomador 64. My great plan was my wife and I were having twins and I was designing a banner maker so I could put a great big banner across my garage door to welcome home my new twins.... well after deciding "how" I was going to accomplish this, I was working hard on creating all the letters and my neighbor said I could buy a program for $19.00 at the store. This banner program had just came out.

End of story, I bought it and the sign was there to welcome home my beautiful twins.

8)

Yeah, they weren't a lot of power, but they sure were fun. I think I've owned every model they ever had, like the portable one, which was really cool for its time. I had a regular C-64 up until about 2 years ago, now I have an emulator. It emulates the old VIC-20, C-64, 128 and the old CBM machines. So, I can still play my old favorites, like Impossible Mission, etc. ;)

"Intelligence is the ability to adapt to change."                                      - Stephen Hawking                                        "...not the ability to exploit others."                                                  - OldCoder
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...