Sign in to follow this  
Followers 0
airrs

[SOLVED]Input Problem

4 posts in this topic

#1 ·  Posted (edited)

I have a problem, ... again

i'm testing a part of a tool. you write something, press ok, and the result ends in a ini file.

this part works.

but when i want to write the next thing, the last shows up in the inputbox

(press "weiter" in the last window and do it again)

#include <GUIConstantsEx.au3>

$x=1

;Hauptfenster

$mainWin = GUICreate("Neuer Account",190,150)
GUICtrlCreateGroup("Auswahl",20,10,150,95)
GUIStartGroup()
$rb1 = GUICtrlCreateRadio("Station",40,25)

$rb4 = GUICtrlCreateGroup("", -99, -99, 1, 1) ;gruppe schließen
$btn = GUICtrlCreateButton("Weiter",80,115)

GUISetState(@SW_SHOW, $mainWin)

;FENSTER 1 - Station

$win1 = GUICreate("Station Hinzufügen",190,150)
GUICtrlCreateLabel("Extension",5,28)
$ein1 = GUICtrlCreateInput("",60,25,110)

$btn1 = GUICtrlCreateButton("Zurück",40,115,50)
$btn2 = GUICtrlCreateButton("Weiter",100,115,50)

;FINAL

$finwin = GUICreate("",130,90)
GUICtrlCreateLabel("Weiter?",5,18)
$btny = GUICtrlCreateButton("Nein",60,40,50)
$btnx = GUICtrlCreateButton("Ja",5,40,50)



While 1
$msg = GUIGetMsg(1)
Switch $msg[1]
Case $mainWin
Switch $msg[0]
Case $GUI_EVENT_CLOSE
Exit
Case $btn
If GUICtrlRead($rb1) = 1 Then
GUISetState(@SW_HIDE, $mainWin)
GUISetState(@SW_SHOW, $win1)
ElseIf GUICtrlRead($rb2) = 1 Then
GUISetState(@SW_HIDE, $mainWin)
GUISetState(@SW_SHOW, $win2)
ElseIf GUICtrlRead($rb3) = 1 Then
GUISetState(@SW_HIDE, $mainWin)222222222
GUISetState(@SW_SHOW, $win3)
EndIf
EndSwitch
Case $win1
Switch $msg[0]
Case $GUI_EVENT_CLOSE
Exit
Case $btn1
GUISetState(@SW_Show,$mainWin)
GUISetState(@SW_HIDE,$win1)
Case $btn2
GUISetState(@SW_SHOW,$finwin)
GUISetState(@SW_HIDE,$win1)
initest()
$x=$x+1
EndSwitch

Case $finwin
Switch $msg[0]
Case $GUI_EVENT_CLOSE
Exit
Case $btnx
GUISetState(@SW_Show,$mainWin)
GUISetState(@SW_HIDE,$finwin)
Case $btny
Exit
EndSwitch
EndSwitch
WEnd

Func initest ()
IniWrite("C:\Documents and Settings\Praktikant\Desktop\test.ini","testsection",$x,GUICtrlRead($ein1))
EndFunc

i hope you can help me

Edited by airrs

Share this post


Link to post
Share on other sites



Many vars have not been declared

Maybe the full script isn't provided

Please declare the vars and repost

Regards

Phoenix XL


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

airrs,

The easiest way to clear the inputs is to store their ControlIDs in an array and then run through the array when you relaunch the loop. Look for the <<<<<<<<< lines: ;)

#include <Array.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
#include <GUIConstantsEx.au3>

$b = True
If $b = True Then FileInstall("////////", "///////////", 1)        ;i had to remove

HotKeySet("{ESC}", "_Exit") ; Set the Hotkey to exit.
$hDLL = DllOpen("user32.dll") ; Open the DLL for _WinIsHovered() (faster with DLL-handle)

$h_Top= GUICreate("////////////", 500, 180, -1, -1, -1, $WS_EX_TOPMOST)            ;i had to remove
; $_Button1 = GUICtrlCreateButton("////////", position rechts-links , hoch-runter, 100, 30)
$_Button1 = GUICtrlCreateButton("", 10, 20, 100, 30)
$_Button2 = GUICtrlCreateButton("Hinzufügen", 10, 60, 100, 30)
$_Button3 = GUICtrlCreateButton("Funk2", 10, 100, 100, 30)
$_Button4 = GUICtrlCreateButton("Funk3", 10, 140, 100, 30)
$_Button5 = GUICtrlCreateButton("", 120, 20, 100, 30)
$_Button6 = GUICtrlCreateButton("Funk4", 120, 60, 100, 30)
$_Button7 = GUICtrlCreateButton("Funk5", 120, 100, 100, 30)
$_Button8 = GUICtrlCreateButton("Funk6", 120, 140, 100, 30)
$_Button9 = GUICtrlCreateButton("Support", 230, 140, 100, 30)
GUICtrlCreatePic ("//////////", 375, 20, 110, 110)            ;i had to remove
GUICtrlCreateLabel ("/////////", 367, 150)

; Move GUI's to the right place and set the Variables State to False
Global $Top_IN = False

_SlideWin($h_Top, "out", "top")

; Show GUI's
GUISetState(@SW_SHOWNOACTIVATE, $h_Top)

While 1 * Sleep(10)
    $nMsg = GUIGetMsg(1)
    Select
      Case $nMsg[0] = -3
            _Exit()
      Case $nMsg[0] = $_Button1
            Run("////////////////////////", "", @SW_MAXIMIZE)    ; i had to remove



      Case $nMsg[0] = $_Button2
            _NewAcc()

      Case $nMsg[0] = $_Button3
            MsgBox(0, "", "to be defined")
      Case $nMsg[0] = $_Button4
            MsgBox(0, "", "to be defined")
      Case $nMsg[0] = $_Button5
            Run("c:program filesmozilla firefoxfirefox.exe http://cssweb01.de.ibm.com/cks-soko", "", @SW_MAXIMIZE)
               Sleep (1200)
                     if ProcessExists("firefox.exe") = 0 Then
                     run ("c:program files (x86)mozilla firefoxfirefox.exe http://cssweb01.de.ibm.com/cks-soko", "", @SW_MAXIMIZE)
                  EndIf
               Sleep (1200)
                  if ProcessExists("firefox.exe") = 0 Then
                     MsgBox(0, "", "Firefox konnte nicht gestartet werden!")
                  EndIf
      Case $nMsg[0] = $_Button6
            MsgBox(0, "", "to be defined")
      Case $nMsg[0] = $_Button7
            MsgBox(0, "", "to be defined")
      Case $nMsg[0] = $_Button8
            MsgBox(0, "", "to be defined")
         Case $nMsg[0] = $_Button9
            Local $Body = InputBox('Body', 'Enter the body (message) of the E-Mail')
            MsgBox(0, 'Supportanfrage', 'E-Mail wurde erstellt! ID ' & _INetMail("lars.heydrich@de.ibm.com", "Supportanfrage DB SOKO Tool", $Body))
        Case _WinIsHovered($h_Top, $hDLL)
            If Not $TOP_IN Then
                _SlideWin($h_Top, "in", "top")
                $TOP_IN = True
            EndIf
        Case Else ; No window is hovered. Check if we need to Slide out a GUI.
            Select
                Case $TOP_IN
                    _SlideWin($h_Top, "out", "top")
                    $TOP_IN = False
            EndSelect
    EndSelect
WEnd

Func _SlideWin($hWnd, $sMode, $sSide)
    ;$hWnd = Window to slide.
    ;$sMode = Slide-In or -out (in|out)
    ;$sSide = Side where you want the GUI to slide. (left|right|top|bottom)
    Local $aScreen_Res = WinGetPos(WinGetHandle("Program Manager"))
    Local $aWPos = WinGetPos($hWnd), $m = 0 - ($sMode = "in") + ($sMode = "out")
    Local $h = 0 - ($sSide = "left") + ($sSide = "right"), $v = 0 - ($sSide = "top") + ($sSide = "bottom")

    WinMove($hWnd, "", _ ; Move GUI according to $sMode and $sSide.
            $aScreen_Res[0] - (($h = -1) * ($m = -1) * ($aWPos[2] - 10)) _
             + (($h = 1) * (($h = 1) * $aScreen_Res[2] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[2])) _
             + (($h = 0) * (($h = 0) * ($aScreen_Res[2] / 2) - ($aWPos[2] / 2))) _
            , _
            $aScreen_Res[1] - (($v = -1) * ($m = -1) * ($aWPos[3] - 10)) _
             + (($v = 1) * (($v = 1) * $aScreen_Res[3] - (10 * ($m = -1)) - ($m <> -1) * $aWPos[3])) _
             + (($v = 0) * (($v = 0) * ($aScreen_Res[3] / 2) - ($aWPos[3] / 2))) _
            )

    $aWPos = WinGetPos($hWnd)
    ; Slide GUI.
    Switch $sSide
        Case "left", "right"
            Local $STEP = (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) - ((($h = -1) And ($m = 1)) Or (($h = 1) And ($m = -1)))) * 10
            Local $FROM = $aWPos[0], $TO = $aWPos[0] _
                     + (((($h = 1) And ($m = 1)) Or (($h = -1) And ($m = -1))) * ($aWPos[2])) _
                     - (((($h = 1) And ($m = -1)) Or (($h = -1) And ($m = 1))) * ($aWPos[2])) - $STEP
            For $i = $aWPos[0] To $TO Step $STEP
                WinMove($hWnd, "", $i, $aWPos[1])
                Sleep(10)
            Next
        Case "top", "bottom"
            Local $STEP = (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) - ((($v = -1) And ($m = 1)) Or (($v = 1) And ($m = -1)))) * 10
            Local $FROM = $aWPos[1], $TO = $aWPos[1] _
                     + (((($v = 1) And ($m = 1)) Or (($v = -1) And ($m = -1))) * ($aWPos[3])) _
                     - (((($v = 1) And ($m = -1)) Or (($v = -1) And ($m = 1))) * ($aWPos[3])) - $STEP
            For $i = $aWPos[1] To $TO Step $STEP
                WinMove($hWnd, "", $aWPos[0], $i)
                Sleep(10)
            Next
    EndSwitch
EndFunc   ;==>_SlideWin

Func _WinIsHovered($hWnd, $vDLL = "User32.dll")
    Local $aResult, $aWPos = WinGetPos($hWnd), $aMPos = MouseGetPos()
    Local $tRect = DllStructCreate("int Left;int Top;int Right;int Bottom")
    Local $iLeft = $aWPos[0], $iTop = $aWPos[1], $iWidth = $aWPos[2], $iHeight = $aWPos[3]
    Local $iX = $aMPos[0], $iY = $aMPos[1]
    DllStructSetData($tRect, "Left", $iLeft)
    DllStructSetData($tRect, "Top", $iTop)
    DllStructSetData($tRect, "Right", $iLeft + $iWidth)
    DllStructSetData($tRect, "Bottom", $iTop + $iHeight)

    $aResult = DllCall($vDLL, "int", "PtInRect", "ptr", DllStructGetPtr($tRect), "int", $iX, "int", $iY)
    If @error Then Return SetError(@error, 0, False)

    Return $aResult[0] <> 0
EndFunc   ;==>_WinIsHovered

Func _NewAcc()

    Local $aEin[10] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    _SlideWin($h_Top, "out", "top")

    ;Main Window
    $mainWin = GUICreate("Neuer Account", 190, 150)
    GUICtrlCreateGroup("Auswahl", 20, 10, 150, 95)
    GUIStartGroup()
    $rb1 = GUICtrlCreateRadio("Station", 40, 25)
    $rb2 = GUICtrlCreateRadio("Agent", 40, 50)
    $rb3 = GUICtrlCreateRadio("Search and Replay", 40, 75)
    GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
    $btn = GUICtrlCreateButton("Weiter", 80, 115)
    GUISetState(@SW_SHOW, $mainWin)

    ;Window 1

    $win1 = GUICreate("Station Hinzufügen", 190, 150)
    GUICtrlCreateLabel("Extension", 5, 28)
    $aEin[0] = GUICtrlCreateInput("", 60, 25, 110) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    GUICtrlCreateLabel("SU", 5, 53)
    $dbox = GUICtrlCreateCombo("", 60, 50, 110)
    GUICtrlCreateLabel("Passwort", 5, 78)
    $aEin[1] = GUICtrlCreateInput("", 60, 75, 110)
    $btn1 = GUICtrlCreateButton("Zurück", 40, 115, 50)
    $btn2 = GUICtrlCreateButton("Weiter", 100, 115, 50)
    GUISetState(@SW_HIDE, $win1)


    ;Window 2

    $win2 = GUICreate("A", 190, 175)
    GUICtrlCreateLabel("Vorname", 5, 28)
    $aEin[2] = GUICtrlCreateInput("", 60, 25, 110)
    GUICtrlCreateLabel("Nachname", 5, 53)
    $aEin[3] = GUICtrlCreateInput("", 60, 50, 110)
    GUICtrlCreateLabel("Mail", 5, 78)
    $aEin[4] = GUICtrlCreateInput("", 60, 75, 110)
    GUICtrlCreateLabel("Gruppe", 5, 103)
    $aEin[5] = GUICtrlCreateInput("", 60, 100, 110)
    $btn3 = GUICtrlCreateButton("Zurück", 40, 140, 50)
    $btn4 = GUICtrlCreateButton("Weiter", 100, 140, 50)
    GUISetState(@SW_HIDE, $win2)

    ;Window 3

    $win3 = GUICreate("SeuR", 190, 175)
    GUICtrlCreateLabel("User ID", 5, 28)
    $aEin[6] = GUICtrlCreateInput("", 60, 25, 110)
    GUICtrlCreateLabel("Vorname", 5, 53)
    $aEin[7] = GUICtrlCreateInput("", 60, 50, 110)
    GUICtrlCreateLabel("Nachname", 5, 78)
    $aEin[8] = GUICtrlCreateInput("", 60, 75, 110)
    GUICtrlCreateLabel("Gruppe", 5, 103)
    $aEin[9] = GUICtrlCreateInput("", 60, 100, 110)
    $btn5 = GUICtrlCreateButton("Zurück", 40, 140, 50)
    $btn6 = GUICtrlCreateButton("Weiter", 100, 140, 50)
    GUISetState(@SW_HIDE, $win3)

    ;Final Window

    $finwin = GUICreate("", 130, 90)
    GUICtrlCreateLabel("Weiter?", 5, 18)
    $btny = GUICtrlCreateButton("Nein", 60, 40, 50)
    $btnx = GUICtrlCreateButton("Ja", 5, 40, 50)
    GUISetState(@SW_HIDE, $finwin)

    While 1
        $msg = GUIGetMsg(1)
        Switch $msg[1]
            Case $mainWin
                Switch $msg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $btn
                        If GUICtrlRead($rb1) = 1 Then
                            GUISetState(@SW_HIDE, $mainWin)
                            GUISetState(@SW_SHOW, $win1)
                        ElseIf GUICtrlRead($rb2) = 1 Then
                            GUISetState(@SW_HIDE, $mainWin)
                            GUISetState(@SW_SHOW, $win2)
                        ElseIf GUICtrlRead($rb3) = 1 Then
                            GUISetState(@SW_HIDE, $mainWin)
                            GUISetState(@SW_SHOW, $win3)
                        EndIf
                EndSwitch
            Case $win1
                Switch $msg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $btn1
                        GUISetState(@SW_SHOW, $mainWin)
                        GUISetState(@SW_HIDE, $win1)
                    Case $btn2
                        GUISetState(@SW_SHOW, $finwin)
                        GUISetState(@SW_HIDE, $win1)
                EndSwitch
            Case $win2
                Switch $msg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $btn3
                        GUISetState(@SW_SHOW, $mainWin)
                        GUISetState(@SW_HIDE, $win2)
                    Case $btn4
                        GUISetState(@SW_SHOW, $finwin)
                        GUISetState(@SW_HIDE, $win2)
                EndSwitch
            Case $win3
                Switch $msg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $btn5
                        GUISetState(@SW_SHOW, $mainWin)
                        GUISetState(@SW_HIDE, $win3)
                    Case $btn6
                        GUISetState(@SW_SHOW, $finwin)
                        GUISetState(@SW_HIDE, $win3)
                EndSwitch
            Case $finwin
                Switch $msg[0]
                    Case $GUI_EVENT_CLOSE
                        ExitLoop
                    Case $btnx
                        GUISetState(@SW_SHOW, $mainWin)
                        GUISetState(@SW_HIDE, $finwin)
                        For $i = 0 To 9 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                            GUICtrlSetData($aEin[$i], "")
                        Next
                    Case $btny
                        GUISetState(@SW_HIDE, $finwin)
                        ;_WinIsHovered($h_Top, $hDLL)
                        ExitLoop
                EndSwitch
        EndSwitch
    WEnd

    ; Delete all GUIs
    GUIDelete($mainWin)
    GUIDelete($win1)
    GUIDelete($win2)
    GUIDelete($win3)
    GUIDelete($finwin)

EndFunc   ;==>_NewAcc

Func _Exit()
    DllClose($hDLL) ; Dont forget to close your DLL-Handle
    Exit
EndFunc   ;==>_Exit

Please ask if you have any questions. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

and you saved me again

whats with the declaration

Many vars have not been declared

Maybe the full script isn't provided

...

i never had a problem with this. should i do it anyway?

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