Jump to content
Sign in to follow this  
Rawox

Close Function (GUI)

Recommended Posts

Rawox

Hi!

I made a function that opens a GUI (help file), but when you click on one of the buttons or the red cross (right top corner) I want it to close the help file and continues the script...

Is there any way to do that?

The Function:

Func HelpFile()
    ToolTip ( "Currently:   Help File Opened"&@CRLF&"Made by:   Rawox"&@CRLF&"Pause:        F3"&@CRLF&"Exit:        F4"&@CRLF&"Help:        F5" , 10, 10, "Information:", 0, 4 )
    GUICreate("Help File", 200, 140)
    GUICtrlCreateLabel("", 20, 20)
    GUICtrlCreateLabel("", 20, 35)
    GUICtrlCreateLabel("", 20, 50)
    GUICtrlCreateLabel("", 20, 65)
    GUICtrlCreateLabel("", 20, 80)
    $quitbutton = GUICtrlCreateButton("Quit", 10, 105, 88)
    $restartbutton = GUICtrlCreateButton("Restart", 100, 105, 88)
    GUISetState(@SW_SHOW)
    
    While 1
      $msg = GUIGetMsg()
        Select
        Case $msg = $restartbutton
            RestartFirefoxHard()
        Case $msg = $quitbutton
            Send ( "{F4}" )
            ProcessClose ( "firefox.exe" )
            Exit
        Case $msg = $GUI_EVENT_CLOSE
            Send ( "{F4}" )
            ProcessClose ( "firefox.exe" )
            Exit
      EndSelect
    WEnd 
EndFunc

/Rawox.

Share this post


Link to post
Share on other sites
FireFox

@Rawox

$GUI_EVENT_CLOSE or -3

Opt('GuiOnEventMode', 1)
GuiCreate('GUI', 200, 200)
GuiSetOnEvent(-3 '_function')
GuiSetState()oÝ÷ Ù«­¢+ÙÕ¥
ÉÑ ÌäíU$Ìäì°ÈÀÀ°ÈÀÀ¤)Õ¥MÑMÑÑ ¤()]¡¥±Ä(ÀÌØíµÍôÕ¥Ñ5Í ¤)M±Ð)
ÍÀÌØíµÍô´Ì(í¼ÍÑÕ)¹M±Ð)]¹

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Rawox

@Rawox

$GUI_EVENT_CLOSE or -3

Opt('GuiOnEventMode', 1)
GuiCreate('GUI', 200, 200)
GuiSetOnEvent(-3 '_function')
GuiSetState()oÝ÷ Ù«­¢+ÙÕ¥
ÉÑ ÌäíU$Ìäì°ÈÀÀ°ÈÀÀ¤)Õ¥MÑMÑÑ ¤()]¡¥±Ä(ÀÌØíµÍôÕ¥Ñ5Í ¤)M±Ð)
ÍÀÌØíµÍô´Ì(í¼ÍÑÕ)¹M±Ð)]¹

Cheers, FireFox.

Can you please explain it, my AutoIt code is not this good :)

Share this post


Link to post
Share on other sites
FireFox

@rawox

ops, I missunderstood you, can you please explain better your problem ? what helpfile to closeand how ?

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
SmOke_N

Func HelpFile()
    ToolTip ( "Currently:   Help File Opened"&@CRLF&"Made by:   Rawox"&@CRLF&"Pause:        F3"&@CRLF&"Exit:        F4"&@CRLF&"Help:        F5" , 10, 10, "Information:", 0, 4 )
    Local $h_gui_child = GUICreate("Help File", 200, 140)
    GUICtrlCreateLabel("", 20, 20)
    GUICtrlCreateLabel("", 20, 35)
    GUICtrlCreateLabel("", 20, 50)
    GUICtrlCreateLabel("", 20, 65)
    GUICtrlCreateLabel("", 20, 80)
    Local $quitbutton = GUICtrlCreateButton("Quit", 10, 105, 88)
    Local $restartbutton = GUICtrlCreateButton("Restart", 100, 105, 88)
    GUISetState(@SW_SHOW, $h_gui_child)
    
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $quitbutton
                Send("{F4}")
                ExitLoop
            Case $restartbutton
                RestartFirefoxHard()
        EndSwitch
    WEnd
    
    GUIDelete($h_gui_child)
    Return
EndFunc


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Rawox

Func HelpFile()
    ToolTip ( "Currently:   Help File Opened"&@CRLF&"Made by:   Rawox"&@CRLF&"Pause:        F3"&@CRLF&"Exit:        F4"&@CRLF&"Help:        F5" , 10, 10, "Information:", 0, 4 )
    Local $h_gui_child = GUICreate("Help File", 200, 140)
    GUICtrlCreateLabel("", 20, 20)
    GUICtrlCreateLabel("", 20, 35)
    GUICtrlCreateLabel("", 20, 50)
    GUICtrlCreateLabel("", 20, 65)
    GUICtrlCreateLabel("", 20, 80)
    Local $quitbutton = GUICtrlCreateButton("Quit", 10, 105, 88)
    Local $restartbutton = GUICtrlCreateButton("Restart", 100, 105, 88)
    GUISetState(@SW_SHOW, $h_gui_child)
    
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $quitbutton
                Send("{F4}")
                ExitLoop
            Case $restartbutton
                RestartFirefoxHard()
        EndSwitch
    WEnd
    
    GUIDelete($h_gui_child)
    Return
EndFunc
It isn't working, it won't close... Started: http://www.autoitscript.com/forum/index.ph...t=0#entry641739

Share this post


Link to post
Share on other sites
SmOke_N

It isn't working, it won't close... Started: http://www.autoitscript.com/forum/index.ph...t=0#entry641739

I removed that topic, keep it to one.

It will close just fine (Tested). If you're speaking of the tooltip, that's a different window. You need to put ToolTip("") before the Return statement to clear it out.

If you're having other issues, it's more than likely you're stuck somewhere else in your code, and you need to post your actual code for assistance.

Edit:

If it's not working for you, I'd almost wager you're using Event Mode GUI stuff for the other code you have. GUIGetMsg() and Event Mode can't be used without resetting the event mode statement before using GUIGetMsg()

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.