Jump to content

Recommended Posts

Posted

I know it's a VERY noob question, but how can I exit a function? :):P

Most functions will exit themselves after they are run or after you meet certain conditions so you don't really have to do anything. Exactly what function are you trying to exit?

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
  • Moderators
Posted

I know it's a VERY noob question, but how can I exit a function? :):P

Check out "Return" in the help file.

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 (edited)

Most functions will exit themselves after they are run or after you meet certain conditions so you don't really have to do anything. Exactly what function are you trying to exit?

I've made a GUI, and tray button which runs the function which has the GUI inside. On the GUI, I want a button to exit that function (of displaying the GUI). GuISetState(@SW_HIDE), indeed hides the GUI, but I can't start it again from the tray, because it's not stopped, but hidden.

I simpy want a GUI that can be closed from the GUI windows itself, and started again from the tray menu.

Edit: SmOke_N, I didn't find any "Return" in the helpfile. :)

Edited by Kiti
Posted

Dunno which helpfile you use but its in mine when i look in the INDEX tab.

:P

Index tab? :)

Here? "C:\Program Files\AutoIt3\Examples\Helpfile" ?

Btw, it should be GREAT if the helpfile would be organized in subfolders like: GUI, WinApi, SQLite, GDIPlus, and so on. Anyone would go directly to what they need, without having to surf through 1.928 files. :P

  • Developers
Posted (edited)

Index tab? :)

Here? "C:\Program Files\AutoIt3\Examples\Helpfile" ?

Btw, it should be GREAT if the helpfile would be organized in subfolders like: GUI, WinApi, SQLite, GDIPlus, and so on. Anyone would go directly to what they need, without having to surf through 1.928 files. :P

Nah.. you are looking at the wrong place for sure.

In SciTE hit F1 or open AutoIt.chm in the AutoIt3 program directory. :P

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Btw, it should be GREAT if the helpfile would be organized in subfolders like: GUI, WinApi, SQLite, GDIPlus, and so on. Anyone would go directly to what they need, without having to surf through 1.928 files. :)

Like the contents are do you mean?
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted (edited)

Nah.. you are looking at the wrong place for sure.

In SciTE hit F1 or open AutoIt.chm in the AutoIt3 program directory. :D

Jos

Wooow!!!! What a huuuge sorted help!! :)

Now I'll surely find what I want. :mad:o:)

"Like the contents are do you mean?"

What? :P Sorry, I didn't understood, please reformulate. :P

Edit: The return is not working. I want to exit a GUI, not to display a variable... Should I provide the script, so you'll better understand what I want to do?

Edited by Kiti
  • Developers
Posted

Edit: The return is not working. I want to exit a GUI, not to display a variable... Should I provide the script, so you'll better understand what I want to do?

Return does exit a Func.. 100% sure.

So what are you trying here ?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

#include <GUIConstantsEx.au3>
#Include <Constants.au3>

Func _show()
Local $YesID, $ExitID, $msg
$gui = GUICreate("Custom Msgbox", 210, 80)
GUICtrlCreateLabel("Please click a button!", 10, 10)
$YesID = GUICtrlCreateButton("Validate!", 25, 40, 100, 30)
$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $YesID
            ;my actual *long* script here
        Case $ExitID
            ;I just want to exit _show, so I can bring it up again using the tray button
        Case $GUI_EVENT_CLOSE
            ;same as above
    EndSwitch
WEnd
Endfunc

#NoTrayIcon
Opt("TrayMenuMode",1)

$display = TrayCreateItem("Display")
TrayCreateItem("")
$exit = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $display
        _show()
        Case $msg = $exit
            Exitloop
    EndSelect
WEnd

Exit

Posted

#include <GUIConstantsEx.au3>
#Include <Constants.au3>

Func _show()
Local $YesID, $ExitID, $msg
$gui = GUICreate("Custom Msgbox", 210, 80)
GUICtrlCreateLabel("Please click a button!", 10, 10)
$YesID = GUICtrlCreateButton("Validate!", 25, 40, 100, 30)
$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $YesID
            ;my actual *long* script here
        Case $ExitID
            ;I just want to exit _show, so I can bring it up again using the tray button
        Case $GUI_EVENT_CLOSE
            ;same as above
    EndSwitch
WEnd
Endfunc

#NoTrayIcon
Opt("TrayMenuMode",1)

$display = TrayCreateItem("Display")
TrayCreateItem("")
$exit = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $display
        _show()
        Case $msg = $exit
            Exitloop
    EndSelect
WEnd

Exit
Case $ExitID
            GUIDelete($gui)
            Return
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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