Sign in to follow this  
Followers 0
Vladi243

GUI- Button Click

19 posts in this topic

#1 ·  Posted (edited)

Hello,

I created a GUI by koda. How can I make the GUI be closed and continue the script, after I click on the button? Please tell me how to make it by koda and without it (by script writing).

Here is my script.

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("GUI", 681, 471, 187, 118)
$Input1 = GUICtrlCreateInput("", 16, 16, 150, 21)
$Input2 = GUICtrlCreateInput("", 16, 48, 150, 21)
$Input3 = GUICtrlCreateInput("", 16, 80, 150, 21)
$Input4 = GUICtrlCreateInput("", 16, 112, 150, 21)
$Input5 = GUICtrlCreateInput("", 16, 144, 150, 21)
$Input6 = GUICtrlCreateInput("", 16, 176, 150, 21)
$Input7 = GUICtrlCreateInput("", 16, 208, 150, 21)
$Input8 = GUICtrlCreateInput("", 16, 240, 150, 21)
$Input9 = GUICtrlCreateInput("", 16, 272, 150, 21)
$Input10 = GUICtrlCreateInput("", 16, 304, 150, 21)
$Input11 = GUICtrlCreateInput("", 182, 16, 150, 21)
$Input12 = GUICtrlCreateInput("", 182, 48, 150, 21)
$Input13 = GUICtrlCreateInput("", 182, 80, 150, 21)
$Input14 = GUICtrlCreateInput("", 182, 112, 150, 21)
$Input15 = GUICtrlCreateInput("", 182, 144, 150, 21)
$Input16 = GUICtrlCreateInput("", 182, 176, 150, 21)
$Input17 = GUICtrlCreateInput("", 182, 208, 150, 21)
$Input18 = GUICtrlCreateInput("", 182, 240, 150, 21)
$Input19 = GUICtrlCreateInput("", 182, 272, 150, 21)
$Input20 = GUICtrlCreateInput("", 182, 304, 150, 21)
$Input21 = GUICtrlCreateInput("", 348, 16, 150, 21)
$Input22 = GUICtrlCreateInput("", 348, 48, 150, 21)
$Input23 = GUICtrlCreateInput("", 348, 80, 150, 21)
$Input24 = GUICtrlCreateInput("", 348, 112, 150, 21)
$Input25 = GUICtrlCreateInput("", 348, 144, 150, 21)
$Input26 = GUICtrlCreateInput("", 348, 176, 150, 21)
$Input27 = GUICtrlCreateInput("", 348, 208, 150, 21)
$Input28 = GUICtrlCreateInput("", 348, 240, 150, 21)
$Input29 = GUICtrlCreateInput("", 348, 272, 150, 21)
$Input30 = GUICtrlCreateInput("", 348, 304, 150, 21)
$Input31 = GUICtrlCreateInput("", 514, 16, 150, 21)
$Input32 = GUICtrlCreateInput("", 514, 48, 150, 21)
$Input33 = GUICtrlCreateInput("", 514, 80, 150, 21)
$Input34 = GUICtrlCreateInput("", 514, 112, 150, 21)
$Input35 = GUICtrlCreateInput("", 514, 144, 150, 21)
$Input36 = GUICtrlCreateInput("", 514, 176, 150, 21)
$Input37 = GUICtrlCreateInput("", 514, 208, 150, 21)
$Input38 = GUICtrlCreateInput("", 514, 240, 150, 21)
$Input39 = GUICtrlCreateInput("", 514, 272, 150, 21)
$Input40 = GUICtrlCreateInput("", 514, 304, 150, 21)
$Input41 = GUICtrlCreateInput("", 16, 336, 150, 21)
$Input43 = GUICtrlCreateInput("", 182, 336, 150, 21)
$Input44 = GUICtrlCreateInput("", 348, 336, 150, 21)
$Input45 = GUICtrlCreateInput("", 514, 336, 150, 21)
$Input42 = GUICtrlCreateInput("", 16, 368, 150, 21)
$Input46 = GUICtrlCreateInput("", 182, 368, 150, 21)
$Input47 = GUICtrlCreateInput("", 348, 368, 150, 21)
$Input48 = GUICtrlCreateInput("", 514, 368, 150, 21)
$Button1 = GUICtrlCreateButton("Start", 290, 408, 100, 40, 0)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd
;Here is the rest script

Thanks,

Vladi.

Edited by Vladi243

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

see sample there:

http://www.autoitscript.com/forum/index.ph...&pid=519552

If you have 1 gui then just use : GUISetState(@SW_hide)

Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

If you have 1 gui then just use : GUISetState(@SW_hide)

Thanks for the response.

I didn't understand how it can help me. It hides the window.

Share this post


Link to post
Share on other sites

I still can't do it. I'll explain again what I want to do.

When I press the button in the GUI that I created, there is no reaction. I want that after the button click, the window would close and continue the script that after the GUI.

Share this post


Link to post
Share on other sites

So you just want to minimize the GUI to System Tray and continue running the script after the button is clicked?

Share this post


Link to post
Share on other sites

No, I want to close the window after the button click.

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=

$swt = 0

$GUI = GUICreate("GUI", 681, 471, 187, 118)
$Input1 = GUICtrlCreateInput("", 16, 16, 150, 21)
$Input2 = GUICtrlCreateInput("", 16, 48, 150, 21)
$Input3 = GUICtrlCreateInput("", 16, 80, 150, 21)
$Input4 = GUICtrlCreateInput("", 16, 112, 150, 21)
$Input5 = GUICtrlCreateInput("", 16, 144, 150, 21)
$Input6 = GUICtrlCreateInput("", 16, 176, 150, 21)
$Input7 = GUICtrlCreateInput("", 16, 208, 150, 21)
$Input8 = GUICtrlCreateInput("", 16, 240, 150, 21)
$Input9 = GUICtrlCreateInput("", 16, 272, 150, 21)
$Input10 = GUICtrlCreateInput("", 16, 304, 150, 21)
$Input11 = GUICtrlCreateInput("", 182, 16, 150, 21)
$Input12 = GUICtrlCreateInput("", 182, 48, 150, 21)
$Input13 = GUICtrlCreateInput("", 182, 80, 150, 21)
$Input14 = GUICtrlCreateInput("", 182, 112, 150, 21)
$Input15 = GUICtrlCreateInput("", 182, 144, 150, 21)
$Input16 = GUICtrlCreateInput("", 182, 176, 150, 21)
$Input17 = GUICtrlCreateInput("", 182, 208, 150, 21)
$Input18 = GUICtrlCreateInput("", 182, 240, 150, 21)
$Input19 = GUICtrlCreateInput("", 182, 272, 150, 21)
$Input20 = GUICtrlCreateInput("", 182, 304, 150, 21)
$Input21 = GUICtrlCreateInput("", 348, 16, 150, 21)
$Input22 = GUICtrlCreateInput("", 348, 48, 150, 21)
$Input23 = GUICtrlCreateInput("", 348, 80, 150, 21)
$Input24 = GUICtrlCreateInput("", 348, 112, 150, 21)
$Input25 = GUICtrlCreateInput("", 348, 144, 150, 21)
$Input26 = GUICtrlCreateInput("", 348, 176, 150, 21)
$Input27 = GUICtrlCreateInput("", 348, 208, 150, 21)
$Input28 = GUICtrlCreateInput("", 348, 240, 150, 21)
$Input29 = GUICtrlCreateInput("", 348, 272, 150, 21)
$Input30 = GUICtrlCreateInput("", 348, 304, 150, 21)
$Input31 = GUICtrlCreateInput("", 514, 16, 150, 21)
$Input32 = GUICtrlCreateInput("", 514, 48, 150, 21)
$Input33 = GUICtrlCreateInput("", 514, 80, 150, 21)
$Input34 = GUICtrlCreateInput("", 514, 112, 150, 21)
$Input35 = GUICtrlCreateInput("", 514, 144, 150, 21)
$Input36 = GUICtrlCreateInput("", 514, 176, 150, 21)
$Input37 = GUICtrlCreateInput("", 514, 208, 150, 21)
$Input38 = GUICtrlCreateInput("", 514, 240, 150, 21)
$Input39 = GUICtrlCreateInput("", 514, 272, 150, 21)
$Input40 = GUICtrlCreateInput("", 514, 304, 150, 21)
$Input41 = GUICtrlCreateInput("", 16, 336, 150, 21)
$Input43 = GUICtrlCreateInput("", 182, 336, 150, 21)
$Input44 = GUICtrlCreateInput("", 348, 336, 150, 21)
$Input45 = GUICtrlCreateInput("", 514, 336, 150, 21)
$Input42 = GUICtrlCreateInput("", 16, 368, 150, 21)
$Input46 = GUICtrlCreateInput("", 182, 368, 150, 21)
$Input47 = GUICtrlCreateInput("", 348, 368, 150, 21)
$Input48 = GUICtrlCreateInput("", 514, 368, 150, 21)
$Button1 = GUICtrlCreateButton("Start", 290, 408, 100, 40, 0)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1 And $swt = 0
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE

$swt = 2        

EndSwitch
WEnd
GUIDelete()
;Here is the rest script

Share this post


Link to post
Share on other sites

I get an error when I tries it.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I get an error when I tries it.

Replace the bottom of you're script with this

$switch = 0

While 1 And $switch = 0
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE

$switch = 2     
EndSwitch
WEnd
GUIDelete()
;Here is the rest script
Edited by JD777

Share this post


Link to post
Share on other sites

It doesn't help.

When I press the button, there is no reaction.

Share this post


Link to post
Share on other sites

k let me explain, in the example i posted you can see how to manage GUI with on event mode. This is a lot more simple & less confusing that while/switch method, especially if your code will be bigger, like 100+ lines. Especially if you are beginner then on event mode is good idea to start with.

in on event mode this what happens:

You click a button & a Button1 function is called like you see GUICtrlSetOnEvent($Button1, "Button1")

in your code ur prog must loop through all code to find matching Case $GUI_EVENT_CLOSE


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

It doesn't help.

When I press the button, there is no reaction.

PASTE THIS INTO EMPTY WINDOW EXACTLY

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=

$GUI = GUICreate("GUI", 681, 471, 187, 118)
$Input1 = GUICtrlCreateInput("", 16, 16, 150, 21)
$Input2 = GUICtrlCreateInput("", 16, 48, 150, 21)
$Input3 = GUICtrlCreateInput("", 16, 80, 150, 21)
$Input4 = GUICtrlCreateInput("", 16, 112, 150, 21)
$Input5 = GUICtrlCreateInput("", 16, 144, 150, 21)
$Input6 = GUICtrlCreateInput("", 16, 176, 150, 21)
$Input7 = GUICtrlCreateInput("", 16, 208, 150, 21)
$Input8 = GUICtrlCreateInput("", 16, 240, 150, 21)
$Input9 = GUICtrlCreateInput("", 16, 272, 150, 21)
$Input10 = GUICtrlCreateInput("", 16, 304, 150, 21)
$Input11 = GUICtrlCreateInput("", 182, 16, 150, 21)
$Input12 = GUICtrlCreateInput("", 182, 48, 150, 21)
$Input13 = GUICtrlCreateInput("", 182, 80, 150, 21)
$Input14 = GUICtrlCreateInput("", 182, 112, 150, 21)
$Input15 = GUICtrlCreateInput("", 182, 144, 150, 21)
$Input16 = GUICtrlCreateInput("", 182, 176, 150, 21)
$Input17 = GUICtrlCreateInput("", 182, 208, 150, 21)
$Input18 = GUICtrlCreateInput("", 182, 240, 150, 21)
$Input19 = GUICtrlCreateInput("", 182, 272, 150, 21)
$Input20 = GUICtrlCreateInput("", 182, 304, 150, 21)
$Input21 = GUICtrlCreateInput("", 348, 16, 150, 21)
$Input22 = GUICtrlCreateInput("", 348, 48, 150, 21)
$Input23 = GUICtrlCreateInput("", 348, 80, 150, 21)
$Input24 = GUICtrlCreateInput("", 348, 112, 150, 21)
$Input25 = GUICtrlCreateInput("", 348, 144, 150, 21)
$Input26 = GUICtrlCreateInput("", 348, 176, 150, 21)
$Input27 = GUICtrlCreateInput("", 348, 208, 150, 21)
$Input28 = GUICtrlCreateInput("", 348, 240, 150, 21)
$Input29 = GUICtrlCreateInput("", 348, 272, 150, 21)
$Input30 = GUICtrlCreateInput("", 348, 304, 150, 21)
$Input31 = GUICtrlCreateInput("", 514, 16, 150, 21)
$Input32 = GUICtrlCreateInput("", 514, 48, 150, 21)
$Input33 = GUICtrlCreateInput("", 514, 80, 150, 21)
$Input34 = GUICtrlCreateInput("", 514, 112, 150, 21)
$Input35 = GUICtrlCreateInput("", 514, 144, 150, 21)
$Input36 = GUICtrlCreateInput("", 514, 176, 150, 21)
$Input37 = GUICtrlCreateInput("", 514, 208, 150, 21)
$Input38 = GUICtrlCreateInput("", 514, 240, 150, 21)
$Input39 = GUICtrlCreateInput("", 514, 272, 150, 21)
$Input40 = GUICtrlCreateInput("", 514, 304, 150, 21)
$Input41 = GUICtrlCreateInput("", 16, 336, 150, 21)
$Input43 = GUICtrlCreateInput("", 182, 336, 150, 21)
$Input44 = GUICtrlCreateInput("", 348, 336, 150, 21)
$Input45 = GUICtrlCreateInput("", 514, 336, 150, 21)
$Input42 = GUICtrlCreateInput("", 16, 368, 150, 21)
$Input46 = GUICtrlCreateInput("", 182, 368, 150, 21)
$Input47 = GUICtrlCreateInput("", 348, 368, 150, 21)
$Input48 = GUICtrlCreateInput("", 514, 368, 150, 21)
$Button1 = GUICtrlCreateButton("Start", 290, 408, 100, 40, 0)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$swt = 0

While 1 And $swt = 0
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
$swt = 2        
;Exit

EndSwitch
WEnd
;Here is the rest script
GUIDelete()
msgbox(4096,"","GUI is gone! Rest of Script will now go on without GUI!")

Share this post


Link to post
Share on other sites

It's works only when I click on X and exit the window, but I want that the script will continue when I click on "Start" button (it's not working).

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

It's works only when I click on X and exit the window, but I want that the script will continue when I click on "Start" button (it's not working).

Is this not working for you?

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)  ; Change to OnEvent mode

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("GUI", 681, 471, 187, 118)
$Input1 = GUICtrlCreateInput("", 16, 16, 150, 21)
$Input2 = GUICtrlCreateInput("", 16, 48, 150, 21)
$Input3 = GUICtrlCreateInput("", 16, 80, 150, 21)
$Input4 = GUICtrlCreateInput("", 16, 112, 150, 21)
$Input5 = GUICtrlCreateInput("", 16, 144, 150, 21)
$Input6 = GUICtrlCreateInput("", 16, 176, 150, 21)
$Input7 = GUICtrlCreateInput("", 16, 208, 150, 21)
$Input8 = GUICtrlCreateInput("", 16, 240, 150, 21)
$Input9 = GUICtrlCreateInput("", 16, 272, 150, 21)
$Input10 = GUICtrlCreateInput("", 16, 304, 150, 21)
$Input11 = GUICtrlCreateInput("", 182, 16, 150, 21)
$Input12 = GUICtrlCreateInput("", 182, 48, 150, 21)
$Input13 = GUICtrlCreateInput("", 182, 80, 150, 21)
$Input14 = GUICtrlCreateInput("", 182, 112, 150, 21)
$Input15 = GUICtrlCreateInput("", 182, 144, 150, 21)
$Input16 = GUICtrlCreateInput("", 182, 176, 150, 21)
$Input17 = GUICtrlCreateInput("", 182, 208, 150, 21)
$Input18 = GUICtrlCreateInput("", 182, 240, 150, 21)
$Input19 = GUICtrlCreateInput("", 182, 272, 150, 21)
$Input20 = GUICtrlCreateInput("", 182, 304, 150, 21)
$Input21 = GUICtrlCreateInput("", 348, 16, 150, 21)
$Input22 = GUICtrlCreateInput("", 348, 48, 150, 21)
$Input23 = GUICtrlCreateInput("", 348, 80, 150, 21)
$Input24 = GUICtrlCreateInput("", 348, 112, 150, 21)
$Input25 = GUICtrlCreateInput("", 348, 144, 150, 21)
$Input26 = GUICtrlCreateInput("", 348, 176, 150, 21)
$Input27 = GUICtrlCreateInput("", 348, 208, 150, 21)
$Input28 = GUICtrlCreateInput("", 348, 240, 150, 21)
$Input29 = GUICtrlCreateInput("", 348, 272, 150, 21)
$Input30 = GUICtrlCreateInput("", 348, 304, 150, 21)
$Input31 = GUICtrlCreateInput("", 514, 16, 150, 21)
$Input32 = GUICtrlCreateInput("", 514, 48, 150, 21)
$Input33 = GUICtrlCreateInput("", 514, 80, 150, 21)
$Input34 = GUICtrlCreateInput("", 514, 112, 150, 21)
$Input35 = GUICtrlCreateInput("", 514, 144, 150, 21)
$Input36 = GUICtrlCreateInput("", 514, 176, 150, 21)
$Input37 = GUICtrlCreateInput("", 514, 208, 150, 21)
$Input38 = GUICtrlCreateInput("", 514, 240, 150, 21)
$Input39 = GUICtrlCreateInput("", 514, 272, 150, 21)
$Input40 = GUICtrlCreateInput("", 514, 304, 150, 21)
$Input41 = GUICtrlCreateInput("", 16, 336, 150, 21)
$Input43 = GUICtrlCreateInput("", 182, 336, 150, 21)
$Input44 = GUICtrlCreateInput("", 348, 336, 150, 21)
$Input45 = GUICtrlCreateInput("", 514, 336, 150, 21)
$Input42 = GUICtrlCreateInput("", 16, 368, 150, 21)
$Input46 = GUICtrlCreateInput("", 182, 368, 150, 21)
$Input47 = GUICtrlCreateInput("", 348, 368, 150, 21)
$Input48 = GUICtrlCreateInput("", 514, 368, 150, 21)
$Button1 = GUICtrlCreateButton("Start", 290, 408, 100, 40, 0)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


; events
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlSetOnEvent($Button1, "Button1")


Func Button1()
    GUIDelete()
    #notrayicon 
     for $a = 1 to 100 ; count till 100
        tooltip($a,0,0)
        sleep(500)
     Next
EndFunc

Func CLOSEClicked()
  Exit
EndFunc


While 1
  Sleep(1000)  ; Idle around
WEnd
Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

Yeah you can try his if you wish but please, try mine. See if this is what you are looking for...

I am kind of an Autoit NOOBIE but I would just like to know if my tweaks helped you or not.

#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=

$swt = 0

$GUI = GUICreate("GUI", 681, 471, 187, 118)
$Input1 = GUICtrlCreateInput("", 16, 16, 150, 21)
$Input2 = GUICtrlCreateInput("", 16, 48, 150, 21)
$Input3 = GUICtrlCreateInput("", 16, 80, 150, 21)
$Input4 = GUICtrlCreateInput("", 16, 112, 150, 21)
$Input5 = GUICtrlCreateInput("", 16, 144, 150, 21)
$Input6 = GUICtrlCreateInput("", 16, 176, 150, 21)
$Input7 = GUICtrlCreateInput("", 16, 208, 150, 21)
$Input8 = GUICtrlCreateInput("", 16, 240, 150, 21)
$Input9 = GUICtrlCreateInput("", 16, 272, 150, 21)
$Input10 = GUICtrlCreateInput("", 16, 304, 150, 21)
$Input11 = GUICtrlCreateInput("", 182, 16, 150, 21)
$Input12 = GUICtrlCreateInput("", 182, 48, 150, 21)
$Input13 = GUICtrlCreateInput("", 182, 80, 150, 21)
$Input14 = GUICtrlCreateInput("", 182, 112, 150, 21)
$Input15 = GUICtrlCreateInput("", 182, 144, 150, 21)
$Input16 = GUICtrlCreateInput("", 182, 176, 150, 21)
$Input17 = GUICtrlCreateInput("", 182, 208, 150, 21)
$Input18 = GUICtrlCreateInput("", 182, 240, 150, 21)
$Input19 = GUICtrlCreateInput("", 182, 272, 150, 21)
$Input20 = GUICtrlCreateInput("", 182, 304, 150, 21)
$Input21 = GUICtrlCreateInput("", 348, 16, 150, 21)
$Input22 = GUICtrlCreateInput("", 348, 48, 150, 21)
$Input23 = GUICtrlCreateInput("", 348, 80, 150, 21)
$Input24 = GUICtrlCreateInput("", 348, 112, 150, 21)
$Input25 = GUICtrlCreateInput("", 348, 144, 150, 21)
$Input26 = GUICtrlCreateInput("", 348, 176, 150, 21)
$Input27 = GUICtrlCreateInput("", 348, 208, 150, 21)
$Input28 = GUICtrlCreateInput("", 348, 240, 150, 21)
$Input29 = GUICtrlCreateInput("", 348, 272, 150, 21)
$Input30 = GUICtrlCreateInput("", 348, 304, 150, 21)
$Input31 = GUICtrlCreateInput("", 514, 16, 150, 21)
$Input32 = GUICtrlCreateInput("", 514, 48, 150, 21)
$Input33 = GUICtrlCreateInput("", 514, 80, 150, 21)
$Input34 = GUICtrlCreateInput("", 514, 112, 150, 21)
$Input35 = GUICtrlCreateInput("", 514, 144, 150, 21)
$Input36 = GUICtrlCreateInput("", 514, 176, 150, 21)
$Input37 = GUICtrlCreateInput("", 514, 208, 150, 21)
$Input38 = GUICtrlCreateInput("", 514, 240, 150, 21)
$Input39 = GUICtrlCreateInput("", 514, 272, 150, 21)
$Input40 = GUICtrlCreateInput("", 514, 304, 150, 21)
$Input41 = GUICtrlCreateInput("", 16, 336, 150, 21)
$Input43 = GUICtrlCreateInput("", 182, 336, 150, 21)
$Input44 = GUICtrlCreateInput("", 348, 336, 150, 21)
$Input45 = GUICtrlCreateInput("", 514, 336, 150, 21)
$Input42 = GUICtrlCreateInput("", 16, 368, 150, 21)
$Input46 = GUICtrlCreateInput("", 182, 368, 150, 21)
$Input47 = GUICtrlCreateInput("", 348, 368, 150, 21)
$Input48 = GUICtrlCreateInput("", 514, 368, 150, 21)
$Button1 = GUICtrlCreateButton("Start", 290, 408, 100, 40, 0)

Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlSetOnEvent($Button1, "CLOSEClicked")
Func CLOSEClicked()
GUIDelete()
EndFunc

GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1 And $swt = 0
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE

$swt = 2        
EndSwitch
WEnd

;Here is the rest script

Share this post


Link to post
Share on other sites

Thank guys, I'll try it in the morning. I have to sleep, it's the middle of night here.

Share this post


Link to post
Share on other sites

goldenix@

I tried your script, and it was realy closed after I clicked on the button, but the whole script closed.

RyGoTypE@,

I tried also your script, and it was realy closed after I clicked the button. In this case the script wasn't closed, but there are no reaction (after I click on the button, my browser supposed to be opened, due to the script I wrote after the GUI).

Do you have another suggestions?

Share this post


Link to post
Share on other sites

goldenix@

I tried your script, and it was realy closed after I clicked on the button, but the whole script closed.

Do you have another suggestions?

Bites me, its working fine for me. If you are complaining about the fact, that the tray icon vanished, then just remove #notrayicon line.


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

OK, it's working now.

I wrote it in this form

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

#Region ### START Koda GUI section ### Form=
$GUI = GUICreate("GUI", 681, 471, 187, 118)
$Input1 = GUICtrlCreateInput("", 16, 16, 150, 21)
$Input2 = GUICtrlCreateInput("", 16, 48, 150, 21)
$Input3 = GUICtrlCreateInput("", 16, 80, 150, 21)
$Input4 = GUICtrlCreateInput("", 16, 112, 150, 21)
$Input5 = GUICtrlCreateInput("", 16, 144, 150, 21)
$Input6 = GUICtrlCreateInput("", 16, 176, 150, 21)
$Input7 = GUICtrlCreateInput("", 16, 208, 150, 21)
$Input8 = GUICtrlCreateInput("", 16, 240, 150, 21)
$Input9 = GUICtrlCreateInput("", 16, 272, 150, 21)
$Input10 = GUICtrlCreateInput("", 16, 304, 150, 21)
$Input11 = GUICtrlCreateInput("", 182, 16, 150, 21)
$Input12 = GUICtrlCreateInput("", 182, 48, 150, 21)
$Input13 = GUICtrlCreateInput("", 182, 80, 150, 21)
$Input14 = GUICtrlCreateInput("", 182, 112, 150, 21)
$Input15 = GUICtrlCreateInput("", 182, 144, 150, 21)
$Input16 = GUICtrlCreateInput("", 182, 176, 150, 21)
$Input17 = GUICtrlCreateInput("", 182, 208, 150, 21)
$Input18 = GUICtrlCreateInput("", 182, 240, 150, 21)
$Input19 = GUICtrlCreateInput("", 182, 272, 150, 21)
$Input20 = GUICtrlCreateInput("", 182, 304, 150, 21)
$Input21 = GUICtrlCreateInput("", 348, 16, 150, 21)
$Input22 = GUICtrlCreateInput("", 348, 48, 150, 21)
$Input23 = GUICtrlCreateInput("", 348, 80, 150, 21)
$Input24 = GUICtrlCreateInput("", 348, 112, 150, 21)
$Input25 = GUICtrlCreateInput("", 348, 144, 150, 21)
$Input26 = GUICtrlCreateInput("", 348, 176, 150, 21)
$Input27 = GUICtrlCreateInput("", 348, 208, 150, 21)
$Input28 = GUICtrlCreateInput("", 348, 240, 150, 21)
$Input29 = GUICtrlCreateInput("", 348, 272, 150, 21)
$Input30 = GUICtrlCreateInput("", 348, 304, 150, 21)
$Input31 = GUICtrlCreateInput("", 514, 16, 150, 21)
$Input32 = GUICtrlCreateInput("", 514, 48, 150, 21)
$Input33 = GUICtrlCreateInput("", 514, 80, 150, 21)
$Input34 = GUICtrlCreateInput("", 514, 112, 150, 21)
$Input35 = GUICtrlCreateInput("", 514, 144, 150, 21)
$Input36 = GUICtrlCreateInput("", 514, 176, 150, 21)
$Input37 = GUICtrlCreateInput("", 514, 208, 150, 21)
$Input38 = GUICtrlCreateInput("", 514, 240, 150, 21)
$Input39 = GUICtrlCreateInput("", 514, 272, 150, 21)
$Input40 = GUICtrlCreateInput("", 514, 304, 150, 21)
$Input41 = GUICtrlCreateInput("", 16, 336, 150, 21)
$Input43 = GUICtrlCreateInput("", 182, 336, 150, 21)
$Input44 = GUICtrlCreateInput("", 348, 336, 150, 21)
$Input45 = GUICtrlCreateInput("", 514, 336, 150, 21)
$Input42 = GUICtrlCreateInput("", 16, 368, 150, 21)
$Input46 = GUICtrlCreateInput("", 182, 368, 150, 21)
$Input47 = GUICtrlCreateInput("", 348, 368, 150, 21)
$Input48 = GUICtrlCreateInput("", 514, 368, 150, 21)
$Button1 = GUICtrlCreateButton("Start", 290, 408, 100, 40, 0)
GUICtrlSetFont(-1, 16, 800, 0, "Arial")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;Events
GUICtrlSetOnEvent($Button1, "clicked")
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
GUISetState()

Func close()
    Exit
EndFunc

Func clicked()
    GUIDelete()
    $i=0
    Do
    ;Here is my rest script
    Until $i=48
EndFunc

While 1
    Sleep (1000);Idle around
WEnd

I put the rest of the script in the Func clicked(). Now the script runs after I press on the button.

Thanks to all of you. :)

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