Sign in to follow this  
Followers 0
qazwsx

Wont show windows

4 posts in this topic

For some reason my script won't show the windows after i press esc the second time.

#include <misc.au3>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables
Global $i
Global $key
Global $list
$key = "{esc}"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Setup
HotKeySet ($key, "_hide")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



While 1
Sleep (1000)

WEnd


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Funcs
Func _hide()
        $list = WinList()
        For $i = 1 to $list[0][0]
        If $list[$i][0] <> "" Then
            WinSetState($list[$i][1], "", @SW_HIDE)
        EndIf
        Next
        HotKeySet ($key)
        HotKeySet ($key, "_show")
EndFunc  ;==>_hide

Func _show()
        For $i = 1 To $list[0][0]
        If $list[$i][0] <> "" Then
            WinSetState($list[$i][1], "", @SW_SHOW)
        EndIf
        Next
        HotKeySet ($key)
        HotKeySet ($key), "_hide")
EndFunc  ;==>_show

Im probable just forgetting something stupid, but i can't seem to find it.

Share this post


Link to post
Share on other sites



For some reason my script won't show the windows after i press esc the second time.

#include <misc.au3>

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Variables
Global $i
Global $key
Global $list
$key = "{esc}"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Setup
HotKeySet ($key, "_hide")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
Sleep (1000)

WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Funcs
Func _hide()
        $list = WinList()
        For $i = 1 to $list[0][0]
        If $list[$i][0] <> "" Then
            WinSetState($list[$i][1], "", @SW_HIDE)
        EndIf
        Next
        HotKeySet ($key)
        HotKeySet ($key, "_show")
EndFunc ;==>_hide

Func _show()
        For $i = 1 To $list[0][0]
        If $list[$i][0] <> "" Then
            WinSetState($list[$i][1], "", @SW_SHOW)
        EndIf
        Next
        HotKeySet ($key)
        HotKeySet ($key), "_hide")
EndFunc ;==>_show

Im probable just forgetting something stupid, but i can't seem to find it.

Change $Key to something else. I suspect that after the first time Esc is defaulting to the normal exit on esc.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I added msgboxes to see where it was going wrong and for some reason esc only calls the hide function it never switches over to the _show one. Also in the help file it says "AND IsVisible($var[$i][1]) Then" But scite give me an error about is visible when i use that.

Edit: never mind about the is visible part.

Edited by sccrstvn93

Share this post


Link to post
Share on other sites

I added msgboxes to see where it was going wrong and for some reason esc only calls the hide function it never switches over to the _show one. Also in the help file it says "AND IsVisible($var[$i][1]) Then" But scite give me an error about is visible when i use that.

Edit: never mind about the is visible part.

What I was trying to say is change your hot key to something other than {ESC} and see what it does. The default action for Esc is to close the GUI. Also take a look at

AutoItSetOption("GUICloseOnESC", <val>)

The default value is 1 which means close the GUI and I think that is what is happening.

A value of 0 will change that behavior.

To summarize

Either

1) Change the HotKey

2) Add ("GUICloseOnESC", 0) at the top of the script.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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