Sign in to follow this  
Followers 0
HockeyFan

HELP!

6 posts in this topic

Can someone help me figure out what I'm doing wrong with this script? ;)

All I want to do is have a GUI window with a message and an OK button. When you click on the OK button, the script exits...when you minimize the GUI, the GUI minimizes for a number of seconds and then restores the GUI window.

What am I doing wrong here? :lmao:

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode 
$Font = "Arial Bold"
$NoConn = GuiCreate(" Please Note...", 536, 350,-1, -1, -1, $WS_EX_TOPMOST)
$NoConnT1 = "Text1"
$NoConnT2 = "Text2"
$NoConnT3 = "Text3"

$NoConnLabel1 = GuiCtrlCreateLabel($NoConnT1, 10, 10, 510, 50, $ES_CENTER)
GUICtrlSetFont(-1, 20, 400, 0, $font)
GUICtrlSetColor ($NoConnLabel1, 0xff0000)
$NoConnLabel2 = GuiCtrlCreateLabel($NoConnT2, 10, 60, 510, 200, $ES_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($NoConnLabel2, 0x0000FF)
$NoConnLabel3 = GuiCtrlCreateLabel($NoConnT3, 10, 200, 510, 40, $ES_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($NoConnLabel3, 0x000080)
$NoConnButton1 = GuiCtrlCreateButton("OK", 210, 270, 120, 30)
GUICtrlSetOnEvent($NoConnButton1, "_Exit")
GUICtrlSetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")
GuiSetState()
    
While 1
Sleep(1000)
WEnd
    
Exit

Func _Exit()
Exit
EndFunc

Func Minimize()
Sleep(1000)
SoundPlay(@WindowsDir & "\media\Windows XP Balloon.wav",1)
GUISetState(@SW_RESTORE, $NoConn)
EndFunc

Share this post


Link to post
Share on other sites



maybe...

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode
$Font = "Arial Bold"
$NoConn = GuiCreate(" Please Note...", 536, 350,-1, -1, -1, $WS_EX_TOPMOST)
$NoConnT1 = "Text1"
$NoConnT2 = "Text2"
$NoConnT3 = "Text3"

$NoConnLabel1 = GuiCtrlCreateLabel($NoConnT1, 10, 10, 510, 50, $ES_CENTER)
GUICtrlSetFont(-1, 20, 400, 0, $font)
GUICtrlSetColor ($NoConnLabel1, 0xff0000)
$NoConnLabel2 = GuiCtrlCreateLabel($NoConnT2, 10, 60, 510, 200, $ES_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($NoConnLabel2, 0x0000FF)
$NoConnLabel3 = GuiCtrlCreateLabel($NoConnT3, 10, 200, 510, 40, $ES_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, $font)
GUICtrlSetColor ($NoConnLabel3, 0x000080)
$NoConnButton1 = GuiCtrlCreateButton("OK", 210, 270, 120, 30)
GUICtrlSetOnEvent($NoConnButton1, "_Exit")

GuiSetState()

GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimizer")
   
While 1
Sleep(1000)
WEnd
   
Exit

Func _Exit()
Exit
EndFunc

Func Minimizer()
GUISetState(@SW_MINIMIZE, $NoConn)
Sleep(1000)
SoundPlay(@WindowsDir & "\media\Windows XP Balloon.wav",1)
GUISetState(@SW_RESTORE, $NoConn)
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

maybe...

Thank you!! ;)

Can I ask why you moved...

GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimizer")oÝ÷ Ù§íz¶®¶­sdwV6WE7FFR

Was my problem that I didn't set the state of the window, I was just activated a function that actually minimized the window? Is that why my function call didn't work?

Trying to learn from my mistakes. :lmao:

Thanks again! :evil:

Share this post


Link to post
Share on other sites

You used

GUICtrlSetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")

I moved it outside the GUISetState() just to let you see the

GUISetOnEvent() ( no CTRL )

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You used

GUICtrlSetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")

I moved it outside the GUISetState() just to let you see the

GUISetOnEvent() ( no CTRL )

8)

OH!!!! :lmao:

I totally missed that! ;)

Sorry...and thank you so much once again!!! :evil:

Edited by HockeyFan

Share this post


Link to post
Share on other sites

OH!!!! :lmao:

I totally missed that! ;)

Sorry...and thank you so much once again!!! :evil:

Welcome!

8)


NEWHeader1.png

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