Sign in to follow this  
Followers 0
Encryption

Stumped on WindowSetState

10 posts in this topic

Mkay first I will start off with the code I am doing for a friend.

;Mason's Improved Internet Explorer Hide
HotKeySet("{PGUP}", "Restore")
HotKeySet("{PGDN}", "Hide")
HotKeySet("{ESC}", "Terminate")

Opt("WinTitleMatchMode", 2)

ToolTip("Explorer Hide V2.0 Is Active", 0, 0)
While 1
    
WEnd
Func Restore()
    ToolTip("Explorer Hide V2.0 Is Active", 0, 0)
    WinSetState("Microsoft Internet Explorer", "", @SW_SHOW)
EndFunc

Func Hide()
    ToolTip("", 3000, 3000)
    WinSetState("Microsoft Internet Explorer", "", @SW_HIDE)

EndFunc

Func Terminate()
    Exit 0
EndFunc

Now, this does everything needed, but I want it to Hide Multiple IE's(all that are minimized and active) and then Restore all the ones that i just hid. Possible?

Share this post


Link to post
Share on other sites



You should enumerate all windows that match the title, grab their window handles to tell them apart, and call WinSetState on each handle:

REPLACE WinSetState("Microsoft Internet Explorer", "", @SW_HIDE)

with the following:

Local $windows = WinList("Microsoft Internet Explorer")
For $i = 1 to $windows[0][0]
   WinSetState($windows[$i][1], "", @SW_HIDE)       
Next

Likewise with @SW_SHOW


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You should enumerate all windows that match the title, grab their window handles to tell them apart, and call WinSetState on each handle:

REPLACE WinSetState("Microsoft Internet Explorer", "", @SW_HIDE)

with the following:

Local $windows = WinList("Microsoft Internet Explorer")
For $i = 1 to $windows[0][0]
   WinSetState($windows[$i][1], "", @SW_HIDE)       
Next

Likewise with @SW_SHOW

<{POST_SNAPBACK}>

Thank you very much, helped a lot

EDIT:

There is an error where the array is declared. I am not a big fan of arrays in AutoIt, nor do I know them well. Do you see any errors?

EDIT: I fixed it, just declared a new array for the other For statement, sorry, my error.

Edited by Encryption

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

There is an error where the array is declared. I am not a big fan of arrays in AutoIt, nor do I know them well. Do you see any errors?

<{POST_SNAPBACK}>

Works okay for me with zero, one, or many windows: :lmao:
HotKeySet("{PGUP}", "Restore")
HotKeySet("{PGDN}", "Hide")
HotKeySet("{ESC}", "Terminate")

Opt("WinTitleMatchMode", 2)

ToolTip("Explorer Hide V2.0 Is Active", 0, 0)
While 1
    sleep(100);prevent maxing out the CPU
WEnd

Func Restore()
    ToolTip("Explorer Hide V2.0 Is Active", 0, 0)
    _SetIEState(@SW_SHOW)
EndFunc

Func Hide()
    ToolTip('')
    _SetIEState(@SW_HIDE)
EndFunc

Func _SetIEState($state)
    Local $i, $windows = WinList("Microsoft Internet Explorer")
    For $i = 1 to $windows[0][0]
        WinSetState($windows[$i][1], "", $state)        
    Next
EndFunc

Func Terminate()
    Exit 0
EndFunc

EDIT: Re-wrote code a little bit.

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Thanks again, my friend will be very happy. I think he is going to sign up in a bit and thank you, he is an AutoIt newbie(yes, more than me) so he will be asking for help quite often.

Share this post


Link to post
Share on other sites

Yes, thanks alot for the help cyber, that was the last piece of the script that we needed help on :lmao:

Share this post


Link to post
Share on other sites

Ya I from rgx too o:)

Thanks cyber :lmao:

Share this post


Link to post
Share on other sites

Invasion of the newbs! :lmao:

Share this post


Link to post
Share on other sites

Invasion of the newbs! :lmao:

<{POST_SNAPBACK}>

*runs around screaming "OMG WE'RE ALL GOING TO DIE!!!"*

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Calmly stands ground with AutoIT Help File*


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
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
Sign in to follow this  
Followers 0