Progress-Bar Leerlauf + Kommandozeilenprogramme

  • Hallo allerseits!

    ICh habe heute wieder drei Fragen:
    1: Ist es möglich eine Progress-Bar "in den Leerlauf zu versetzen"? Also das z.B. bei Vista der grüne Klecks immer von Null zu hundert und wieder und wieder...
    2: Gleiches wie oben, nur dass der Klecks von Null nach Hundert und wieder zurück nach null soll.
    3: Kann ich wie bei VB etc. die Shell von Microsoft verwenden (Console.WriteLine("Hallo!") z.B.)

    Dankeschön!

  • Danke, aber was ist hier falsch?:

    [autoit]


    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Form1", 560, 57, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $Progress1 = GUICtrlCreateProgress(0, 16, 545, 25)
    GuiCTrlSetState(-1, $PBS_MARQUEE)
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    WEnd

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

    Func Form1Close()
    Exit
    EndFunc

    [/autoit]
  • Hi, schonmal drüber nachgedacht die Hilfe zu benutzen? :P

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <SendMessage.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $Form1 = GUICreate("Form1", 545, 25, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
    $Progress1 = GUICtrlCreateProgress(0, 0, 545, 25, $PBS_MARQUEE)
    $hProgress = GUICtrlGetHandle($Progress1)
    _SendMessage($hProgress, $PBM_SETMARQUEE, True, 10)
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    WEnd

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

    Func Form1Close()
    Exit
    EndFunc ;==>Form1Close

    [/autoit]

    anno2008 ;)

  • Danke! Dann ist Frage 1 geklärt, aber was ist mit 2 und 3?

    anno2008: Wie hast du die Form verschwinden lassen? Welcher PArameter war dafür verantwortlich?

    Danke für die Beantwortung der Frage 1!

  • zu 3.:
    Geht auf jeden fall, wenn man im CUI modus kompiliert
    dann hat man aber keine gui...
    falls du darauf verzichten kannst nimm (im CUI modus) ConsoleWrite() her
    kannst die progressbars auch in andere exe dateien auslagern^^

    Padmak

  • vielleicht ist das so etwas was du meinst?

    Spoiler anzeigen
    [autoit]

    #include<SliderConstants.au3>
    #include<StaticConstants.au3>
    #include<GUIConstantsEx.au3>
    #include<ProgressConstants.au3>

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

    Global $hGui = GUICreate('Klassische Progressbar', 420, 280, -1, -1)

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

    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 0) ; auf den klassischen Style umschalten
    Global $hProgress1 = GUICtrlCreateProgress(15, 20, 384, 20, $PBS_SMOOTH) ; obere Progressbar erstellen
    GUICtrlSetColor(-1, 0x22FF22)
    GUICtrlSetBkColor(-1, 0xEEEEEE)
    GUICtrlCreateLabel('|', 18, 40, 20, 16) ; Anzeige von 0%
    GUICtrlCreateLabel('0%', 11, 56, 25, 16, $SS_CENTER)
    GUICtrlCreateLabel('|', 396, 40, 20, 16) ; Anzeige von 100%
    GUICtrlCreateLabel('100%', 389, 56, 25, 16, $SS_CENTER)

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

    Global $hLabel1 = GUICtrlCreateLabel('0%', 190, 24, 30, 14, $SS_CENTER) ; Prozentanzeige innerhalb der Progressbar
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; Transparenter Hintergrund für das Label

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

    Global $hProgress2 = GUICtrlCreateProgress(15, 160, 384, 20, $PBS_SMOOTH) ; untere Progressbar erstellen
    GUICtrlSetColor(-1, 0xC83131)
    GUICtrlSetBkColor(-1, 0xEEEEEE)
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'int', 7) ; zurück zum Standard-Windowsstyle

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

    For $i = 0 To 100 Step 10 ; die Anzeige für die Prozentwerte der unteren Progressbar erstellen
    GUICtrlCreateLabel('|', 16 + $i * 3.8, 180, 20, 16)
    GUICtrlCreateLabel($i & '%', 9 + $i * 3.8, 196, 25, 16, $SS_CENTER)
    Next

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

    Global $hSlider = GUICtrlCreateSlider(5, 130, 404, 28, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
    GUICtrlSetData(-1, 33) ; Sliderwert auf 33% setzen (als Beispiel)

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

    Global $hClose = GUICtrlCreateButton('Close', 180, 240, 60, 24)
    GUISetState(@SW_SHOW)

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

    Global $iAddend = 1 ; globale Variable (dient als Summand für _SetProgress)
    AdlibEnable('_SetProgress', 30)

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

    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE, $hClose
    Exit
    EndSwitch
    WEnd

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

    Func _SetProgress()
    Local $iPercent = GUICtrlRead($hProgress1) ; Prozentwert der oberen Progressbar auslesen
    If $iPercent = 100 Or $iPercent = 0 Then $iAddend = -$iAddend ; wenn 100 oder Null, dann den Summand negieren
    GUICtrlSetData($hProgress1, $iPercent + $iAddend) ; neuen Wert der oberen Progressbar schreiben
    GUICtrlSetData($hLabel1, $iPercent + $iAddend & '%') ; neuen Wert für das Label schreiben
    GUICtrlSetData($hProgress2, GUICtrlRead($hSlider)) ; und den Wert vom Slider in die untere Progressbar schreiben
    EndFunc ;==>_SetProgress

    [/autoit]

    MfG Schnuffel

    "Sarkasmus ist die niedrigste Form des Witzes, aber die höchste Form der Intelligenz."
    Val McDermid

    über mich...

    ich habe meine Erfahrungen hauptsächlich gesammelt in (grobe Übersicht):

    - RibbonBar Automation
    - MySQL Nutzung
    - GUIs in vielerlei Ausprägung
    - Nutzung von Powershell / Batch in AutoIt
    - Windows Automatisierung

    außerhalb von AutoIt:

    - Sprachen: PS, Batch, php, html(5), javascript, (perl eingeschränkt), vbs
    - Powershell (AD, WPF inkl. Multi-Threading, ...)
    - Deployment-Automatisierung ohne SCCM
    - Office-Nutzung mit COM-Object (AutoIt, PowerShell)
    - ActiveDirectory und alles was damit zusammenhängt
    - Hyper-V Clustering (Converged / Hyper Converged)
    - Serverhardware (Konfiguration, Aufbau, Architektur, Betrieb)

    Lieblingsthema:

    günstige Automatisierung von Vorgängen, für die andere Firmen viel Geld nehmen

    more to come ...

  • Also, erst mal danke an alle!

    Schnuffel: Ich meinte es etwas anders, aber dein Programm hat mich auf eine Idee für mein Projekt gebracht! Danke!!! :D

    Also, ich dachte mir das so ungefähr, wie L3viathan2142 (ging dein Name nicht noch ein bisschen komplizierter :D :(
    Ein Marquee das auf 100 läuft, dann zurück auf 0 dann wieder auf 100,
    so wie man es von manchen PRogrammen kennt, die eine Serververbindung aufbauen...

    • Offizieller Beitrag

    Meinst du sowas?
    Mit AdlibDisable() läßt sich das dann Beenden.

    Spoiler anzeigen
    [autoit]

    Global $SwipBar[2], $aSwipPos[4], $xSwip, $up = True

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

    $gui = GUICreate('test')
    GUISetState()

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

    $arBar = _SwipBarOn(10, 10, 300, 17)
    $t = TimerInit()
    Do
    If TimerDiff($t) > 5000 Then _SwipBarOff() ; nach 5 Sekunden wird Bar gelöscht
    Until GUIGetMsg() = -3

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

    Func _SwipBarOn($x, $y, $width, $heigth, $iCol=0xff0000, $iBkCol=0x0000ff)
    Local $swipWidth = Floor($width/3)
    $SwipBar[0] = GUICtrlCreateLabel('', $x, $y, $width, $heigth)
    GUICtrlSetBkColor(-1, $iBkCol)
    $SwipBar[1] = GUICtrlCreateLabel('', $x, $y, $swipWidth, $heigth)
    GUICtrlSetBkColor(-1, $iCol)
    $aSwipPos[0] = $x
    $aSwipPos[1] = $y
    $aSwipPos[2] = $swipWidth
    $aSwipPos[3] = $width
    AdlibEnable('_swip', 30)
    Return $SwipBar
    EndFunc

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

    Func _swip()
    If $up Then
    $xSwip += 5
    Else
    $xSwip -= 5
    EndIf
    If $up And ($xSwip + $aSwipPos[2] >= $aSwipPos[0] + $aSwipPos[3]) Then $up = False
    If Not $up And ($xSwip <= $aSwipPos[0]) Then $up = True
    ControlMove($gui, '', $SwipBar[1], $xSwip, $aSwipPos[1])
    EndFunc

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

    Func _SwipBarOff()
    AdlibDisable()
    GUICtrlDelete($arBar[0])
    GUICtrlDelete($arBar[1])
    EndFunc

    [/autoit]