Inputbox einbinden

  • Morgääähn,

    ich brauche mal wieder eure Hilfe...folgendes:
    In dem kommenden Script soll eine Inputbox eingebunden werden, die während $play=1 immer mit dem Hotkey Strg+o abgerufen werden soll. Bei Eingabe eines Zahlenwertes und OK, soll $time mit $newtime geupdated und auch fürs nächste Mal gespeichert werden. Bei CANCEL soll alter Wert stehen bleiben.
    Wäre jemand bereit mir unter die Arme zu greifen???

    [autoit]

    ;~ script for next sample automation

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

    #include <Misc.au3>

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

    Dim $play
    Dim $time = 20
    Dim $exit = 1
    $dll = DllOpen("user32.dll")

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

    HotKeySet("^{SPACE}", "starten")
    HotKeySet("^{x}", "stoppen")

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

    WinWait("Analyst -", "")

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

    $manuellerclick = False
    While $exit
    While $play = 1
    if Not $manuellerclick then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    Endif
    AdlibRegister("_Countdown", 1000)
    While $time > 0 And $play = 1
    ToolTip($time)
    Sleep(10)
    $manuellerclick = False
    If _IsPressed("04", $dll) Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    $manuellerclick = True
    ExitLoop
    EndIf
    WEnd
    ToolTip($time)
    AdlibUnRegister("_Countdown")
    $time = 20
    WEnd
    Sleep(250)

    While $play = 0
    ToolTip("")
    WEnd

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

    WEnd

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

    Func _Countdown()
    $time -= 1
    EndFunc ;==>_Countdown
    Func starten()
    $play = 1
    EndFunc ;==>starten
    Func stoppen()
    $play = 0
    EndFunc ;==>stoppen

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

    DllClose($dll)

    [/autoit]


    Und die Inputbox like this:

    [autoit]

    HotKeySet ("^o", "timeroption")

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

    Func timeroption()
    $newtime = InputBox("Timer-Einstellung", "Bitte gewünschte Sekunden angeben", "", "", 210, 120)
    EndFunc

    [/autoit]


    Vielen Dank!
    Mel

    3 Mal editiert, zuletzt von MelS3247 (6. Mai 2010 um 11:39)

  • sollte so oder so ähnlich klappen ;)

    Spoiler anzeigen
    [autoit]


    ;~ Morgääähn,

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

    ;~ ich brauche mal wieder eure Hilfe...folgendes:
    ;~ In dem kommenden Script soll eine Inputbox eingebunden werden, die während $play=1 immer mit dem Hotkey Strg+o abgerufen werden soll. Bei Eingabe eines Zahlenwertes und OK, soll $time mit $newtime geupdated
    ;~ und auch fürs nächste Mal gespeichert werden. Bei CANCEL soll alter Wert stehen bleiben.
    ;~ Wäre jemand bereit mir unter die Arme zu greifen???

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

    #include <Misc.au3>

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

    Dim $play
    Dim $time = 20
    Dim $exit = 1
    $dll = DllOpen("user32.dll")

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

    HotKeySet("^{SPACE}", "starten")
    HotKeySet("^{x}", "stoppen")
    HotKeySet("^{o}", "timeroption")

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

    WinWait("Analyst -", "")

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

    $manuellerclick = False
    While $exit
    While $play = 1
    If Not $manuellerclick Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    EndIf
    AdlibRegister("_Countdown", 1000)
    While $time > 0 And $play = 1
    ToolTip($time)
    Sleep(10)
    $manuellerclick = False
    If _IsPressed("04", $dll) Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    $manuellerclick = True
    ExitLoop
    EndIf
    WEnd
    ToolTip($time)
    AdlibUnRegister("_Countdown")
    $time = 20
    WEnd
    Sleep(250)

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

    While $play = 0
    ToolTip("")
    WEnd

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

    WEnd

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

    DllClose($dll)

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

    Func _Countdown()
    $time -= 1
    EndFunc ;==>_Countdown

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

    Func starten()
    $play = 1
    EndFunc ;==>starten

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

    Func stoppen()
    $play = 0
    EndFunc ;==>stoppen

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

    Func timeroption()
    If $play Then
    $newtime = InputBox("Timer-Einstellung", "Bitte gewünschte Sekunden angeben", "", "", 210, 120)
    If isint($newtime) And not @error Then
    $time = $newtime
    EndIf
    EndIf
    EndFunc ;==>timeroption

    [/autoit]
  • Leider wird der timer nur einmalig auf den neuen Wert eingestellt. Sollte aber, wenn möglich, so gespeichert werden, bis eine neue Eingabe über InputBox erfolgt.
    Gibt es denn sowas wie einen SAVE befehl???

    Gruß Mel

    Einmal editiert, zuletzt von MelS3247 (6. Mai 2010 um 08:47)

  • *neeeeeeerv*

    nerv doch bitte nicht. und schongarnicht gleich nach ner stunde. geht so auch nicht schneller.


    probiers mal so:

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>

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

    Dim $play
    Dim $timealt = 20
    Dim $exit = 1
    $dll = DllOpen("user32.dll")

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

    HotKeySet("^{SPACE}", "starten")
    HotKeySet("^{x}", "stoppen")
    HotKeySet("^{o}", "timeroption")

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

    WinWait("Analyst -", "")

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

    $manuellerclick = False
    While $exit
    While $play = 1
    If Not $manuellerclick Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    EndIf
    $time = $timealt
    AdlibRegister("_Countdown", 1000)
    While $time > 0 And $play = 1
    ToolTip($time)
    Sleep(10)
    $manuellerclick = False
    If _IsPressed("04", $dll) Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    $manuellerclick = True
    ExitLoop
    EndIf
    WEnd
    ToolTip($time)
    AdlibUnRegister("_Countdown")
    $time = 20
    WEnd
    Sleep(250)

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

    While $play = 0
    ToolTip("")
    WEnd

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

    WEnd

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

    DllClose($dll)

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

    Func _Countdown()
    $time -= 1
    EndFunc ;==>_Countdown

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

    Func starten()
    $play = 1
    EndFunc ;==>starten

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

    Func stoppen()
    $play = 0
    EndFunc ;==>stoppen

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

    Func timeroption()
    If $play Then
    $newtime = InputBox("Timer-Einstellung", "Bitte gewünschte Sekunden angeben", "", "", 210, 120)
    If isint($newtime) And not @error Then
    $timealt = $newtime
    EndIf
    EndIf
    EndFunc ;==>timeroption

    [/autoit]
  • sorry...das ner hab ich auf meine eigene dummheit bezogen ;)

    aber dein script-vorschlag funktioniert leider immer noch nicht...timer bleibt trotzdem auf 20

  • oh sry da gibts wohl n problem mit isint.

    probiers mal so:

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>

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

    Dim $play
    Dim $time = 20
    Dim $exit = 1
    $dll = DllOpen("user32.dll")

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

    HotKeySet("^{SPACE}", "starten")
    HotKeySet("^{x}", "stoppen")
    HotKeySet("^{o}", "timeroption")

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

    WinWait("Analyst -", "")

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

    $manuellerclick = False
    While $exit
    While $play = 1
    If Not $manuellerclick Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    EndIf
    AdlibRegister("_Countdown", 1000)
    While $time > 0 And $play = 1
    ToolTip($time)
    Sleep(10)
    $manuellerclick = False
    If _IsPressed("04", $dll) Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    $manuellerclick = True
    ExitLoop
    EndIf
    WEnd
    ToolTip($time)
    AdlibUnRegister("_Countdown")
    $time = 20
    WEnd
    Sleep(250)

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

    While $play = 0
    ToolTip("")
    WEnd

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

    WEnd

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

    DllClose($dll)

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

    Func _Countdown()
    $time -= 1
    EndFunc ;==>_Countdown

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

    Func starten()
    $play = 1
    EndFunc ;==>starten

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

    Func stoppen()
    $play = 0
    EndFunc ;==>stoppen

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

    Func timeroption()
    If $play Then
    $newtime = Int(InputBox("Timer-Einstellung", "Bitte gewünschte Sekunden angeben", "", "", 210, 120))
    If $newtime And not @error Then
    $time = $newtime
    EndIf
    EndIf
    EndFunc ;==>timeroption

    [/autoit]
  • Sorry, aber wird wieder nur einmal gespeichert...beim nächsten MausRadKlick ist der alte Wert von 20 wieder drin. :wacko:

  • och mädchen. bisschen eigeninitiative bitte
    in zeile 35 wirds auf 20 gesetzt ist doch klar dasses dann wieder 20 is

    ein programm in dem du nicht den überblick behältst hilft dir eh nichts. also versuch alles zu verstehen

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>

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

    Global $timealt = 20, $exit = 1, $play
    $dll = DllOpen("user32.dll")

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

    HotKeySet("^{SPACE}", "starten")
    HotKeySet("^{x}", "stoppen")
    HotKeySet("^{o}", "timeroption")

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

    WinWait("Analyst -", "")

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

    $manuellerclick = False
    While $exit
    While $play = 1
    $time = $timealt
    If Not $manuellerclick Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    EndIf
    AdlibRegister("_Countdown", 1000)
    While $time > 0 And $play = 1
    ToolTip($time)
    Sleep(10)
    $manuellerclick = False
    If _IsPressed("04", $dll) Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    $manuellerclick = True
    ExitLoop
    EndIf
    WEnd
    ToolTip($time)
    AdlibUnRegister("_Countdown")
    WEnd
    Sleep(250)

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

    While $play = 0
    ToolTip("")
    WEnd

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

    WEnd

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

    DllClose($dll)

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

    Func _Countdown()
    $time -= 1
    EndFunc ;==>_Countdown

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

    Func starten()
    $play = 1
    EndFunc ;==>starten

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

    Func stoppen()
    $play = 0
    EndFunc ;==>stoppen

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

    Func timeroption()
    If $play Then
    $newtime = Int(InputBox("Timer-Einstellung", "Bitte gewünschte Sekunden angeben", "", "", 210, 120))
    If $newtime And not @error Then
    $timealt = $newtime
    EndIf
    EndIf
    EndFunc ;==>timeroption

    [/autoit]
  • Hallo MelS3247,

    dann ändere Zeile 35:

    [autoit]

    $time = 20

    [/autoit]

    in

    [autoit]

    $time = $newtime

    [/autoit]

    und zusätzlich fügst du noch in Zeile 5 dieses ein

    [autoit]

    Dim $newtime = $time

    [/autoit]

    mfg (Auto)Bert

  • Ne, sorry, aber eine Sache noch...
    wenn man das Script komplett schließt und wieder neu startet, dann ist der Timer auch wieder bei 20...kann man das noch ändern, dass der letzte Wert vom Input immer der aktuelle ist, auch bei Neustart!!!???

  • habs dir mal gebastelt:

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>

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

    Global $timealt = Iniread(@Tempdir & "\MeineIni.ini", "Section", "Zeit", "20")
    Global $exit = 1, $play
    $dll = DllOpen("user32.dll")

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

    HotKeySet("^{SPACE}", "starten")
    HotKeySet("^{x}", "stoppen")
    HotKeySet("^{o}", "timeroption")

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

    WinWait("Analyst -", "")

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

    $manuellerclick = False
    While $exit
    While $play = 1
    $time = $timealt
    If Not $manuellerclick Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    EndIf
    AdlibRegister("_Countdown", 1000)
    While $time > 0 And $play = 1
    ToolTip($time)
    Sleep(10)
    $manuellerclick = False
    If _IsPressed("04", $dll) Then
    WinActivate("Analyst -", "")
    ControlSend("Analyst -", "", "AfxOleControl42u2", "^{RIGHT}")
    $manuellerclick = True
    ExitLoop
    EndIf
    WEnd
    ToolTip($time)
    AdlibUnRegister("_Countdown")
    WEnd
    Sleep(250)

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

    While $play = 0
    ToolTip("")
    WEnd

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

    WEnd

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

    DllClose($dll)

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

    Func _Countdown()
    $time -= 1
    EndFunc ;==>_Countdown

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

    Func starten()
    $play = 1
    EndFunc ;==>starten

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

    Func stoppen()
    $play = 0
    EndFunc ;==>stoppen

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

    Func timeroption()
    If $play Then
    $newtime = Int(InputBox("Timer-Einstellung", "Bitte gewünschte Sekunden angeben", "", "", 210, 120))
    If $newtime And not @error Then
    $timealt = $newtime
    Iniwrite(@Tempdir & "\MeineIni.ini", "Section", "Zeit", $timealt)
    EndIf
    EndIf
    EndFunc ;==>timeroption

    [/autoit]

    edit: ups sry für doppelpost

  • ok...habs erstmal selbst versucht...ini schreiben ging noch, aber mit ini lesen lassen hatte ich dann ne fehlermeldung...deshalb danke für deine hilfe!

    und wieder "gelöst"!!!