Sprung in nächste Zeile.

  • Nabend,

    ich möchte das nachdem mein Text abgesendet wurde, das Script im Editfeld eine Zeile runterspringt. Aber iwie möchte er nicht..

    führt das Script am Besten aus, dann wisst ihr was ich meine ;)

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <TreeViewConstants.au3>
    #include <StaticConstants.au3>
    #include <misc.au3>

    [/autoit][autoit][/autoit][autoit]

    $dll = DllOpen("user32.dll")
    global $User = "Kev"
    GUICreate("Chatomatic",600,300)
    GUICtrlCreateListView("Angemeldete User",475,0,130,300)
    $chatbox = GuictrlcreateEdit("",0,0,475,250)
    $inhalt = GuictrlcreateInput("",10,260,350,25)
    $send = GuictrlcreateButton("Senden",370,260,100,25)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit]

    While 1
    $msg = GUIGetMsg()
    switch $msg
    case $send
    sende()
    Endswitch
    If _IsPressed("0D", $dll) Then
    sende()
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    DllClose($dll)

    [/autoit][autoit][/autoit][autoit]

    func sende()
    Guictrlsetdata($chatbox,$User & ": " & Guictrlread($inhalt) & @crlf)
    sleep(150) ;timeout da sonst leere übergabe
    Guictrlsetdata($inhalt,"")
    Endfunc

    [/autoit]

    Einmal editiert, zuletzt von Kev (13. Mai 2011 um 12:26)

  • Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <TreeViewConstants.au3>
    #include <StaticConstants.au3>
    #include <misc.au3>
    #include <GuiEdit.au3>
    $dll = DllOpen("user32.dll")
    Global $User = "Kev"
    GUICreate("Chatomatic", 600, 300)
    GUICtrlCreateListView("Angemeldete User", 475, 0, 130, 300)
    $chatbox = GUICtrlCreateEdit("", 0, 0, 475, 250, $ES_READONLY)
    $inhalt = GUICtrlCreateInput("", 10, 260, 350, 25)
    $send = GUICtrlCreateButton("Senden", 370, 260, 100, 25)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $send
    sende()
    EndSwitch
    If _IsPressed("0D", $dll) Then
    sende()
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    DllClose($dll)

    [/autoit] [autoit][/autoit] [autoit]

    Func sende()
    If Not StringStripWS(GUICtrlRead($inhalt), 1) = "" Then
    _GUICtrlEdit_AppendText($chatbox, $User & ": " & StringStripWS(GUICtrlRead($inhalt), 1) & @CRLF)
    Sleep(150) ;timeout da sonst leere übergabe
    GUICtrlSetData($inhalt, "")
    EndIf
    EndFunc ;==>sende

    [/autoit]
    • Offizieller Beitrag

    Das geht aber auch einfacher:

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $User = "Kev"
    GUICreate("Chatomatic", 600, 300)
    GUICtrlCreateListView("Angemeldete User", 475, 0, 130, 300)
    $chatbox = GUICtrlCreateEdit("", 0, 0, 475, 250)
    $inhalt = GUICtrlCreateInput("", 10, 260, 350, 25)
    $send = GUICtrlCreateButton("Senden", 370, 260, 100, 25, $BS_DEFPUSHBUTTON)
    GUISetState(@SW_SHOW)
    ControlFocus("Chatomatic", "", $inhalt)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GUIGetMsg()
    Case $send
    sende()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func sende()
    GUICtrlSetData($chatbox, $User & ": " & GUICtrlRead($inhalt) & @CRLF, 1)
    GUICtrlSetData($inhalt, "")
    ControlFocus("Chatomatic", "", $inhalt)
    EndFunc ;==>sende

    [/autoit]
  • kay habs jetz dochj mit oscars version gemacht ;)

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <TreeViewConstants.au3>
    #include <StaticConstants.au3>
    #include <misc.au3>
    #include <fILE.au3>
    #include <EditConstants.au3>
    #include <GuiEdit.au3>
    #include <ButtonConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    global $config
    abfragecheck()

    [/autoit][autoit][/autoit][autoit]

    $dll = DllOpen("user32.dll")

    [/autoit][autoit][/autoit][autoit]

    global $User = $config[1]

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    GUICreate("Chatomatic",600,300)
    $amodul = GUICtrlCreateListView("Angemeldete User",475,0,130,300)
    $chatbox = GuictrlcreateEdit("",0,0,475,250,$ES_READONLY)
    $inhalt = GuictrlcreateInput("",10,260,350,25)
    $send = GUICtrlCreateButton("Senden", 370, 260, 100, 25, $BS_DEFPUSHBUTTON)
    GuictrlcreateListviewItem($config[1],$amodul)
    GUISetState(@SW_SHOW)
    ControlFocus("Chatomatic", "", $inhalt)

    [/autoit][autoit][/autoit][autoit]

    While 1
    Switch GUIGetMsg()
    Case $send
    sende()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    ;#Funktionen#########################################################################################################################
    Func sende()
    GUICtrlSetData($chatbox, $User & ": " & GUICtrlRead($inhalt) & @CRLF, 1)
    GUICtrlSetData($inhalt, "")
    ControlFocus("Chatomatic", "", $inhalt)
    EndFunc ;==>sende

    [/autoit][autoit][/autoit][autoit]

    Func firstuse()
    $Inputbox = Inputbox("Benutzername","Für die Anmeldung des Chatomatix wird ein Benutzername benötigt, wie möchtest du heißen:?")
    $IP = Inputbox("Konfiguration","Bitte gebe nun die ServerIP des Servers ein")
    Filewrite(@scriptdir & "\config.cfg",$Inputbox & @crlf & $IP)
    Endfunc

    [/autoit][autoit][/autoit][autoit]

    func abfragecheck()
    if FileExists(@scriptdir & "\config.cfg") then
    _FileReadToArray(@scriptdir & "\config.cfg",$config)
    else
    firstuse()
    Endif
    Endfunc

    [/autoit]

    nur noch die übrigen includes raus ^^ aber thx