Dgameman1 Posted September 5, 2011 Posted September 5, 2011 So in my gui, there is a button that says notepad. I want it so that when I press Notepad, the button notepad hides, and something else shows up. This is my code ; Press Esc to terminate script, Pause/Break to "pause" ; ; ---------------------------------------------------------------------------- ; AutoIt Version: 3.3.6.1 ; Author:Baked beans ; ---------------------------------------------------------------------------- #include <INet.au3> #include <GuiButton.au3> #include <GuiToolBar.au3> #include <GuiConstantsEx.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GuiCreate("Titles",409,503,322,166) $button1=GuiCtrlCreateButton("About",351,6,50,20) $button2=GuiCtrlCreateButton("Notepad",55,43,297,29) $button3=GuiCtrlCreateButton("Sauce",151,107,200,30) $label1=GuiCtrlCreateLabel("Select A Button",169,9,88,15) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() msgbox(32, "About Title", "Created by Dgameman1.") EndFunc Func button2() $button3 EndFunc Func button3() EndFunc
Dgameman1 Posted September 5, 2011 Author Posted September 5, 2011 I think I got it, can someone tell me if I'm doing this correctly This is my button 2 Func button2() GuiCreate("Hardy Har Har",409,503,322,166) GuiSetState() EndFunc
Dgameman1 Posted September 5, 2011 Author Posted September 5, 2011 Here is my whole code now and it doesn't work =[ expandcollapse popup; Press Esc to terminate script, Pause/Break to "pause" ; ; ---------------------------------------------------------------------------- ; AutoIt Version: 3.3.6.1 ; Author: title ; ---------------------------------------------------------------------------- #include <INet.au3> #include <GuiButton.au3> #include <GuiToolBar.au3> #include <GuiConstantsEx.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GuiCreate("title",409,503,322,166) $button1=GuiCtrlCreateButton("About",351,6,50,20) $button2=GuiCtrlCreateButton("notepad",55,43,297,29) $button3=GuiCtrlCreateButton("sauce",151,107,200,30) $label1=GuiCtrlCreateLabel("Select",169,9,88,15) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit If $msg=$button1 Then button1() If $msg=$button2 Then button2() If $msg=$button3 Then button3() Wend Func button1() msgbox(32, "About title", "Created by title.") EndFunc Func button2() GuiCreate("title - Notepad",409,503,322,166) $button3=GuiCtrlCreateButton("About",351,6,50,20) GuiSetState() While 1 $msg=GuiGetMsg() If $msg=-3 Then Exit Wend Func button3() msgbox(32, "About title", "Created by title") EndFunc EndFunc Func button3() EndFunc
monoscout999 Posted September 5, 2011 Posted September 5, 2011 (edited) ; Press Esc to terminate script, Pause/Break to "pause" ; ; ---------------------------------------------------------------------------- ; AutoIt Version: 3.3.6.1 ; Author:Baked beans ; ---------------------------------------------------------------------------- #include <INet.au3> #include <GuiButton.au3> #include <GuiToolBar.au3> #include <GuiConstantsEx.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUICreate("Titles", 409, 503, 322, 166) $button1 = GUICtrlCreateButton("About", 351, 6, 50, 20) $button2 = GUICtrlCreateButton("Notepad", 55, 43, 297, 29) $button3 = GUICtrlCreateButton("Sauce", 151, 107, 200, 30) $label1 = GUICtrlCreateLabel("Select A Button", 169, 9, 88, 15) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit If $msg = $button1 Then button1() If $msg = $button2 Then button2() If $msg = $button3 Then button3() WEnd Func button1() MsgBox(32, "About Title", "Created by Dgameman1.") EndFunc ;==>button1 Func button2() GUICtrlSetState($button2, $GUI_HIDE) EndFunc ;==>button2 Func button3() EndFunc ;==>button3 this hide the button. EDIT: You have a repeated function and you are not closing well the Funcs Edited September 5, 2011 by monoscout999 Dgameman1 1
Dgameman1 Posted September 5, 2011 Author Posted September 5, 2011 ; Press Esc to terminate script, Pause/Break to "pause" ; ; ---------------------------------------------------------------------------- ; AutoIt Version: 3.3.6.1 ; Author:Baked beans ; ---------------------------------------------------------------------------- #include <INet.au3> #include <GuiButton.au3> #include <GuiToolBar.au3> #include <GuiConstantsEx.au3> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GUICreate("Titles", 409, 503, 322, 166) $button1 = GUICtrlCreateButton("About", 351, 6, 50, 20) $button2 = GUICtrlCreateButton("Notepad", 55, 43, 297, 29) $button3 = GUICtrlCreateButton("Sauce", 151, 107, 200, 30) $label1 = GUICtrlCreateLabel("Select A Button", 169, 9, 88, 15) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit If $msg = $button1 Then button1() If $msg = $button2 Then button2() If $msg = $button3 Then button3() WEnd Func button1() MsgBox(32, "About Title", "Created by Dgameman1.") EndFunc ;==>button1 Func button2() GUICtrlSetState($button2, $GUI_HIDE) EndFunc ;==>button2 Func button3() EndFunc ;==>button3 this hide the button. EDIT: You have a repeated function and you are not closing well the Funcs Thank you so much =D
monoscout999 Posted September 5, 2011 Posted September 5, 2011 Thank you so much =DYou are welcome i am mr. Tidy you can check your syntaxis errors in the console output from SciTe.
Dgameman1 Posted September 5, 2011 Author Posted September 5, 2011 (edited) Ok, I have another problem Func button1() msgbox(32, "About", "Created by mee") EndFunc Func button2() GUICtrlSetState($button2, $GUI_HIDE) GUICtrlSetState($button3, $GUI_HIDE) GUICtrlSetState($label1, $GUI_HIDE) $label2=GuiCtrlCreateLabel("Select a task",169,9,100,30) $button99=GuiCtrlCreateButton("Go back",10,6,50,20) Func button99() GUICtrlSetState($label99, $GUI_HIDE) GUICtrlSetState($label2, $GUI_HIDE) EndFunc EndFunc Func button3() EndFunc How can I now make button99 do something? Edited September 5, 2011 by Dgameman1
monoscout999 Posted September 5, 2011 Posted September 5, 2011 aaaah i see now what you mean.. you should predeclarate as Global $button99 = 999999 in the top of the script... After that, you must put the Case $button99 in the main loop despite this exists or not... do not create Functions inside another functions that is totally wrong.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now