Jump to content

Recommended Posts

Posted

Whats the code for the script to close, when the "x" in the top right of the gui is pressed? Mine doesnt seem to be included when I generate the code for the gui.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
  • Moderators
Posted

If your using GUIGetMsg() then it would be something like:

$Msg = GUIGetMsg()
If $Msg = -3 Then Exit; or $GUI_EVENT_CLOSE

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

Tryed both, non worked Oo

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Posted (edited)

This should work=

;setup the gui
#include <GUIconstants.au3>
Guicreate("My gui")
Guisetstate()


While 1
$msg = guigetmsg()

If $msg = $GUI_EVENT_CLOSE THen exit

wend
Edited by rambo3889
My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!
Posted (edited)

Save rambo's code as a script and it will work... don't copy it into your own script.

If it's still doesn't work, then please tell us what you mean ? What happens ?

Is it an error-message ? What version of AutoIt are you running ?

Edited by Helge
Posted

#include <GUIConstants.au3>
#include <IE.au3>
Opt("GUIOnEventMode", 1)
### Koda GUI section start ###
$YouTubeUpload = GUICreate("YouTubeUpload", 284, 220, 190, 117)
$UserName = GUICtrlCreateInput("Username", 0, 0, 281, 21)
$o_IE = ObjCreate("Shell.Explorer.2")
$o_IE_ctrl = GUICtrlCreateObj($o_IE, 0, 176, 74, 92)
GUICtrlSetState(-1, $GUI_HIDE)
$PassWord = GUICtrlCreateInput("Password", 0, 24, 281, 21)
$Title = GUICtrlCreateInput("Title", 0, 48, 281, 21)
$Description = GUICtrlCreateInput("Description", 0, 72, 281, 21)
$Tags = GUICtrlCreateInput("Tags", 0, 96, 281, 21)
$Private = GUICtrlCreateRadio("Private", 80, 152, 65, 17)
$Public = GUICtrlCreateRadio("Public", 8, 152, 65, 17)
$File = GUICtrlCreateInput("File", 0, 120, 281, 21)
$Upload = GUICtrlCreateButton("Upload", 152, 144, 129, 33, 0)
GUICtrlSetOnEvent(-1, "UploadClick")
$Load = GUICtrlCreateLabel("...", 112, 190, 61, 17, $SS_CENTER)
GUISetState(@SW_SHOW)
### Koda GUI section end   ###

While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
    Sleep(100)
WEnd

Func UploadClick()
GUICtrlSetData($Load, "Uploading")
GUICtrlSetState($Upload, $GUI_DISABLE)
EndFunc

Doesnt work for me ><

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Posted

#include <GUIConstants.au3>
;~ #include <IE.au3>
;~ ### Koda GUI section start ###
$YouTubeUpload = GUICreate("YouTubeUpload", 284, 220, 190, 117)
$UserName = GUICtrlCreateInput("Username", 0, 0, 281, 21)
$o_IE = ObjCreate("Shell.Explorer.2")
$o_IE_ctrl = GUICtrlCreateObj($o_IE, 0, 176, 74, 92)
GUICtrlSetState(-1, $GUI_HIDE)
$PassWord = GUICtrlCreateInput("Password", 0, 24, 281, 21)
$Title = GUICtrlCreateInput("Title", 0, 48, 281, 21)
$Description = GUICtrlCreateInput("Description", 0, 72, 281, 21)
$Tags = GUICtrlCreateInput("Tags", 0, 96, 281, 21)
$Private = GUICtrlCreateRadio("Private", 80, 152, 65, 17)
$Public = GUICtrlCreateRadio("Public", 8, 152, 65, 17)
$File = GUICtrlCreateInput("File", 0, 120, 281, 21)
$Upload = GUICtrlCreateButton("Upload", 152, 144, 129, 33, 0)
$Load = GUICtrlCreateLabel("...", 112, 190, 61, 17, $SS_CENTER)
GUISetState()
;~ ### Koda GUI section end   ###

While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then Exit
;~   Sleep(100)
If $msg = $Upload Then UploadClick()
WEnd

Func UploadClick()
GUICtrlSetData($Load, "Uploading")
GUICtrlSetState($Upload, $GUI_DISABLE)
EndFunc

You were using event and if

My Scripts:Radioblog Club Music DownloaderOther stuff:Fun movieIm serious read the help file it helps :PFight 'Till you drop. Never stop, You Cant give up. Til you reach the top Fight! you’re the best in town Fight!
  • Moderators
Posted

You CAN'T use GUIGetMsg() with GUIOnEventMode!!!

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

Put this just before you while-loop :

GUISetOnEvent($GUI_EVENT_CLOSE, "quit")oÝ÷ ÚØ^­¶¬jÛayéÝ¡ü¨º»®*mjëh×6Func Quit()
    Exit
EndFunc
Thanks.
# MY LOVE FOR YOU... IS LIKE A TRUCK- #

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...