Jump to content

Recommended Posts

Posted

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.

Posted

@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.

Posted

@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 :)
Posted

@rawox

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

Cheers, FireFox.

  • Moderators
Posted

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.

Posted

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
  • Moderators
Posted (edited)

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.

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
×
×
  • Create New...