Hiilfeee

  • Hey Leute,
    Ich versuche gerade einen kleinen Messagebox-Generator zu erstellen.
    Allerdings hab ich ein kleines Problem mit den Variablen...

    Spoiler anzeigen

    $Text = GUICtrlRead($Input1)
    $Titel = GUICtrlRead($Input2)
    $Zahl = GUICtrlRead($Input3)
    FileWrite ( "Messagebox.vbs", "MsgBox$Text,$Zahl,$Titel" )

    Mein Problem ist,dass die Variablen nicht erkannt werden..
    Bitte um Hilfe! :)

  • hehe xD | Du musst den Operator & einfügen ;)

    FileWrite ( "Messagebox.vbs", "MsgBox$Text,$Zahl,$Titel" )

    Da machst du das raus:

    FileWrite ( "Messagebox.vbs", "MsgBox" & $Text & $Zahl & $Titel )


    Falls es immernoch nicht funktioniert, dann poste bitte das ganze Script.

  • Hi,

    ich hatte mir mal son Teil gebaut, wurde bissl was dran rumgenörgelt.

    Z.b., dass man statt den ganzen If's ne "Select-" bzw "Switch-" Abfrage machen könnte. Mir hat das so gereicht, funktioniert ja auch bestens! :)

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=AutoIT_Icons\PPG.ico
    #AutoIt3Wrapper_outfile=MsgBox_Generator.exe
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    ;msgbox-generator

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

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

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

    #Region ### START Koda GUI section ### Form=
    $msgbox = GUICreate("MsgBox-Generator", 366, 507, 373, 20)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $btn0 = GUICtrlCreateRadio("OK", 16, 32, 33, 17)
    $btn1 = GUICtrlCreateRadio("OK und Abbrechen", 16, 48, 113, 17)
    $btn2 = GUICtrlCreateRadio("Abbrechen, Wiederholen, Ignorieren", 16, 64, 193, 17)
    $btn3 = GUICtrlCreateRadio("Ja, Nein, Abbrechen", 16, 80, 121, 17)
    $btn4 = GUICtrlCreateRadio("Ja und Nein", 16, 96, 81, 17)
    $btn5 = GUICtrlCreateRadio("Wiederholen und Abbrechen", 16, 112, 161, 17)
    $btn6 = GUICtrlCreateRadio("Abbrechen, Wiederholen, Weiter", 16, 128, 177, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $std0 = GUICtrlCreateRadio("Erster Button", 224, 32, 81, 17)
    $std1 = GUICtrlCreateRadio("Zweiter Button", 224, 48, 89, 17)
    $std2 = GUICtrlCreateRadio("Dritter Button", 224, 64, 81, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $ic0 = GUICtrlCreateRadio("Kein Icon", 16, 168, 65, 17)
    $ic1 = GUICtrlCreateRadio("Stopp-Zeichen", 16, 184, 89, 17)
    $ic2 = GUICtrlCreateRadio("Fragezeichen", 16, 200, 89, 17)
    $ic3 = GUICtrlCreateRadio("Ausrufezeichen", 16, 216, 97, 17)
    $ic4 = GUICtrlCreateRadio("Information", 16, 232, 73, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $mod0 = GUICtrlCreateRadio("Anwendung", 224, 200, 81, 17)
    $mod1 = GUICtrlCreateRadio("System-modal", 224, 216, 89, 17)
    $mod2 = GUICtrlCreateRadio("Task-modal", 224, 232, 81, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $son0 = GUICtrlCreateRadio("nichts weiteres", 224, 104, 113, 17)
    $son1 = GUICtrlCreateRadio("immer im Vordergrund", 224, 120, 121, 17)
    $son2 = GUICtrlCreateRadio("Text rechtsbündig", 224, 136, 105, 17)
    $Label1 = GUICtrlCreateLabel("Buttons:", 16, 16, 43, 17)
    $Label2 = GUICtrlCreateLabel("Icon:", 16, 152, 28, 17)
    $Label3 = GUICtrlCreateLabel("Standard Button:", 224, 16, 84, 17)
    $Label4 = GUICtrlCreateLabel("Sonstiges:", 224, 88, 53, 17)
    $Label5 = GUICtrlCreateLabel("Modalität:", 224, 184, 50, 17)
    $Label6 = GUICtrlCreateLabel("Ausgabe:", 16, 448, 49, 17)
    $out = GUICtrlCreateInput("", 16, 472, 329, 21)
    $go = GUICtrlCreateButton("MsgBox Generieren", 16, 384, 331, 41, $WS_GROUP)
    $Label7 = GUICtrlCreateLabel("Titel:", 16, 256, 27, 17)
    $ititel = GUICtrlCreateInput("Überschrift", 16, 280, 329, 21)
    $Label8 = GUICtrlCreateLabel("Text:", 16, 304, 28, 17)
    $itext = GUICtrlCreateInput("Ich bin eine Msgbox!", 16, 328, 329, 21)
    $testing = GUICtrlCreateCheckbox("Testen?", 280, 440, 65, 17)
    GUICtrlSetState($testing,$GUI_CHECKED)
    $Label9 = GUICtrlCreateLabel("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _", 16, 352, 340, 17)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    GUICtrlSetState($btn0,$GUI_CHECKED)
    GUICtrlSetState($std0,$GUI_CHECKED)
    GUICtrlSetState($ic0,$GUI_CHECKED)
    GUICtrlSetState($mod0,$GUI_CHECKED)
    GUICtrlSetState($son0,$GUI_CHECKED)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $go
    generate()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

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

    func generate()
    Local $test
    Local $flag = 0
    Local $titel = GUICtrlRead($ititel)
    Local $text = GUICtrlRead($itext)

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

    if GUICtrlRead($btn0) = 1 Then $flag += 0
    if GUICtrlRead($btn1) = 1 Then $flag += 1
    if GUICtrlRead($btn2) = 1 Then $flag += 2
    if GUICtrlRead($btn3) = 1 Then $flag += 3
    if GUICtrlRead($btn4) = 1 Then $flag += 4
    if GUICtrlRead($btn5) = 1 Then $flag += 5
    if GUICtrlRead($btn6) = 1 Then $flag += 6
    if GUICtrlRead($ic0) = 1 Then $flag += 0
    if GUICtrlRead($ic1) = 1 Then $flag += 16
    if GUICtrlRead($ic2) = 1 Then $flag += 32
    if GUICtrlRead($ic3) = 1 Then $flag += 48
    if GUICtrlRead($ic4) = 1 Then $flag += 64
    if GUICtrlRead($mod0) = 1 Then $flag += 0
    if GUICtrlRead($mod1) = 1 Then $flag += 4096
    if GUICtrlRead($mod2) = 1 Then $flag += 8192
    if GUICtrlRead($std0) = 1 Then $flag += 0
    if GUICtrlRead($std1) = 1 Then $flag += 256
    if GUICtrlRead($std2) = 1 Then $flag += 512
    if GUICtrlRead($son0) = 1 Then $flag += 0
    if GUICtrlRead($son1) = 1 Then $flag += 262144
    if GUICtrlRead($son2) = 1 Then $flag += 524288

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

    $test = 'MsgBox(' & $flag & ',"' & $titel & '","' & $text & '")'

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

    GUICtrlSetData($out,$test)

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

    if GUICtrlRead($testing) = 1 then Execute($test)

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

    EndFunc

    [/autoit]

    Grüße
    x0r

    Simon nörgelt, Simon nervt - aber Simon verbessert die Welt. Glaubt er.

  • Was bezahlst den?

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.