Jump to content

Recommended Posts

Posted

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
Posted

Here is my whole code now and it doesn't work =[

; 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
Posted (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 by monoscout999
Posted

; 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

Posted (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 by Dgameman1
Posted

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.

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