Jump to content

set text from input


Recommended Posts

i figured it out didnt see a post that told me lol

Edited by toothyXdip
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

well, here we go.. try this (i left old script intact)

changes:

removed the function to set the name, a lot easier to just set it directly

removed the next button, clicking on set name now moves the script along to the next screen

you had quotes around the point where you were trying to display the name set:

$name_lable = GUICtrlCreateLabel("Show name here", 10, 20)

$name_lable2 = GUICtrlCreateLabel("$name_input, here", 120, 40)

so i changed this to be correct

hopefully all changes are clear.

#include <GUIConstants.au3>
Global $name_input

;window---------------------
GUICreate("Welcome", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUICtrlSetCursor(-1, 3)
$dummy = GUICtrlCreateDummy()
GUICtrlSetCursor(-1, 3)
GUISetBkColor(0x000000)
GUICtrlSetOnEvent($GUI_EVENT_CLOSE, 'send_dummy')
GUICtrlSetCursor(-1, 3)
GUICtrlSetCursor(-1, 3)
GUICtrlSetCursor(-1, 3)
GUICtrlSetState(-1, $GUI_DISABLE)
;lables---------------------
GUISetFont(14, 700)
$main_lable = GUICtrlCreateLabel("my question press start", 10, 10)
GUICtrlSetCursor(-1, 3)
$main_lable2 = GUICtrlCreateLabel("for me to show", 50, 30)
GUICtrlSetCursor(-1, 3)
GUISetFont(12, 400)
;colorsets------------------
GUICtrlSetBkColor($main_lable, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor($main_lable2, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor($main_lable, 0xFFFFFF)
GUICtrlSetColor($main_lable2, 0xFFFFFF)
GUISetState(@SW_SHOW)
;buttons--------------------
$start_button = GUICtrlCreateButton("Start", 70, 150, 70, 20)
GUICtrlSetCursor(-1, 3)
$exit_button = GUICtrlCreateButton("Exit", 170, 150, 70, 20)
GUICtrlSetCursor(-1, 3)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $exit_button
            OnButtonExit()
        Case $msg = $start_button
            start_button()
    EndSelect
WEnd

;functions-----------------

Func send_dummy()
    GUICtrlSendToDummy($dummy)
EndFunc

Func OnButtonExit()
    While 1
    $anwser = MsgBox(36, "Quit?", "Do you want to quit?")
    If $anwser = 6 Then
        Exit
    ElseIf $anwser = 7 Then
        ExitLoop
    EndIf
WEnd
EndFunc

Func start_button()
    GUIDelete()
    ;window-----------------
    GUICreate("Set name", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;lable------------------
    GUISetFont(13, 900)
    $name_lable = GUICtrlCreateLabel("Set name here", 10, 20)
    $name_lable2 = GUICtrlCreateLabel("", 120, 40)
    ;button-----------------
;    $next_button2 = GUICtrlCreateButton("Next", 210, 170, 70, 20)
    $pick_name = GUICtrlCreateButton("SetName", 105, 170, 100, 20)
    ;input-------------------
    $name_input = GUICtrlCreateInput("Pick Name", 110, 90, 100, 20)
    ;colorsets--------------
    GUICtrlSetBkColor($name_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor($name_lable2, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($name_lable, 0xFFFFFF)
    GUICtrlSetColor($name_lable2, 0xFFFFFF)
   
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
        Case $msg = $pick_name
;            readnameinput()
                $read_name = GUICtrlRead($name_input)
                next_($read_name)
;        Case $msg = $next_button2
;            next_()
    EndSelect
WEnd
EndFunc

#cs - remove useless function -
Func readnameinput()
    $read_name = GUICtrlRead($name_input)
    Return($read_name)
EndFunc
#CE - end remove useless function -

Func next_($read_name)
    GUIDelete()
    ;window-----------------
    GUICreate("Set name", 300, 200 , 390, 240, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;lable------------------
    GUISetFont(13, 900)
    $name_lable = GUICtrlCreateLabel("Show name here", 10, 20)
    $name_lable2 = GUICtrlCreateLabel($read_name, 120, 40)
    ;colorsets--------------
    GUICtrlSetBkColor($name_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor($name_lable2, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($name_lable, 0xFFFFFF)
    GUICtrlSetColor($name_lable2, 0xFFFFFF)
   
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
    EndSelect
WEnd
EndFunc
Edited by tAKTelapis
Link to comment
Share on other sites

  • Moderators

I didn't go through the whole code, but I did notice you had a GUICtrlSetOnEvent() (Wrong syntax really for event close, should be GUISetOnEvent()) and GUIGetMsg(). The 2 don't work well together, might want to remove line 10 (although I don't see it effecting the code your asking about).

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.

Link to comment
Share on other sites

how can i make it still read it 2 windows after the window with the input

---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

  • Moderators

how can i make it still read it 2 windows after the window with the input

You've been told... GUICtrlRead().

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

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