1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. casi4712

Beiträge von casi4712

  • Automatische DriveSpace Kontrolle

    • casi4712
    • 17. Juli 2022 um 13:56

    okay, dann hatte ich wohl gedacht er aktualisiert das automatisch wenn ich AdlibRegister nehme, war wohl ein Denkfehler, die Funktion soieht nun so aus:

    AutoIt
    Func _Testspace()
    global $fslabel = ""
    Global $free = DriveSpaceFree($drive) / 1024
    
        if $free < 15 Then
           ;$fslabel = "Drive Space auf System-Laufwerk wird knapp !!!"
            GUICtrlSetData($LabelSpace, "freier Speicher auf System wird knapp: " & $free)
        else
            GUICtrlSetData($LabelSpace, "")
        endif
          ;MsgBox(0, "Drive Free Space For " & $drive, $free)
    EndFunc
    Alles anzeigen

    Nur noch eins kurz, wie kann ich $freeIP auf 2 Nachkommastellen beschneiden


    einen schönen Sonnstag noch und Danke


    lg

    chris

  • Automatische DriveSpace Kontrolle

    • casi4712
    • 16. Juli 2022 um 14:23

    Hey, danke erst mal für Eure Mithilfe,

    das mit AdLib Register CreateLabvels war natürlich blödsinn, ist wohl beim isolieren des Teilcodes entstanden, klar dass dann das Label in einer Dauerschleife läuft, also der Code sieht so aus. Dann sollte doch nur noch ein entsprechendes GuiCtrlSetData() fehlen , oder?

    Der Code

    C
    ; includes ---------------------------------------------------------------------
    #include-once
    
    #include "Services.au3"
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    #include <StringConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    
    ; opt --------------------------------------------------------------------------
    Opt('MustDeclareVars', 1)
    
    ;declaration ------------------------------------------------------------------
    ;GUI Variables
    Global $ActiveCheck, $result
    Global $ARRAY_COLOR_TOP_MIN[3] = [36, 65, 142]
    Global $ARRAY_COLOR_TOP_MAX[3] = [11, 42, 122]
    Global $RBOX_EVENT_CLOSE  = 1
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    Global $SubBack = 0xEAF0E2
    
    global $var_system_drive = StringLeft(@WindowsDir, 2); SystemDrive auslesen
    Global Const $drive = StringLeft( $var_system_drive, 3)
    global $iFreeSpace = ""
    global $fslabel = ""
    global $LabelSpace
    
    ;AdLibRegistering----------------------------------------------------------------------------------------------
    AdlibRegister('_Testspace', 5000)
    ;--------------------------------------------------------------------------------------------------------------
    
    
    ; processing --------------------------------------------------------------------------------------------------
    
    Global $hGui = RBoxCreate("Test", 840, 610)
    
    ;FunctionCalls-------------------------------------------------------------------------------------------------
    _Testspace()
    _createLabels()
    ;--------------------------------------------------------------------------------------------------------------
    
    
    
    ;Main Logic;--------------------------------------------------------------------------------------------------------------
    While True
        CheckX($hGui, $RBOX_EVENT_CLOSE, "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0xA3A3A3)", "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0x555555)")
    
       local $gMsg = GUIGetMsg()
        Switch $gMsg
            Case $GUI_EVENT_CLOSE, $RBOX_EVENT_CLOSE
                GUIDelete($hGui)
                AdlibUnRegister('_Testspace')
                Exit
    
            Case  $labelSpace
             global $iFreeSpace = DriveSpaceFree(@HomeDrive & "\")
               MsgBox($MB_SYSTEMMODAL, "", "Free Space: " & $Free & " GB")
          
        EndSwitch
    
    WEnd
        
    ;-----------------------------------------------------------------------------------------------------------------------
    
    ;-----------------------------------------------------------------------------------------------------------------------
    Func _createLabels()
    
        $labelSpace = GUICtrlCreateLabel($FSlabel, 150, 340, 350, 150)
          GUICtrlSetColor(-1, 0xF00404) ; red
          GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)      
          
    EndFunc
    ;-----------------------------------------------------------------------------------------------------------------------
    
    ;-----------------------------------------------------------------------------------------------------------------------
    Func _Testspace()
    global $fslabel = ""
    Global $free = DriveSpaceFree($drive) / 1024
    
        if $free < 21 Then; Schwellwert in GB
           $fslabel = "Drive Space auf System-Laufwerk wird knapp !!!"
        else
           $fslabel = ""
        endif
      ;MsgBox(0, "Drive Free Space For " & $drive, $free)
    EndFunc
    ;----------------------------------------------------------------------------------------------------------------------
    
    
    
    
    
    ;GUI STYLE;--------------------------------------------------------------------------------------------------------------
    ;-----------------------------------------------------------------------------------------------------------------------
    Func RBoxCreate($Title, $width, $height, $left = -1, $top = -1, $show = 1)
        Local $GUI = GUICreate($Title, $width, $height, $left, $top, $WS_POPUP)
        ;GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
             GUICtrlSetState(-1, $GUI_DISABLE)
        GUISetBkColor($GUIBKCOLOR, $GUI)
         ;_GuiRoundCorners($GUI,0,0,$ROUNDES,$ROUNDES)
        $RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X', $width - 20, 3, 25, 25)
        GUICtrlSetCursor($RBOX_EVENT_CLOSE, 0)
        GUICtrlSetBkColor($RBOX_EVENT_CLOSE, -2)
        GUICtrlSetFont($RBOX_EVENT_CLOSE, 15, 800)
        GUICtrlSetColor($RBOX_EVENT_CLOSE, 0x555555)
    
        $Title &= " "
        Local $hTitle = GUICtrlCreateLabel($Title, 0, 0, $width - 20, 26, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont($hTitle, 17, 400, 0, "Consolas")
        GUICtrlSetBkColor($hTitle, -2)
        Local $Graphic = GUICtrlCreateGraphic(0, 0, $width, 25)
        GUICtrlSetState($Graphic, $Gui_DISABLE)
        ;GradientFill($Graphic, 0, 0, $width, 25, $ARRAY_COLOR_TOP_MIN, $ARRAY_COLOR_TOP_MAX)
        If $show = 1 Then GUISetState(@SW_SHOW, $GUI)
    
        Return $GUI
    EndFunc
    
    
    
    Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
        Local $cGui = GUIGetCursorInfo($hGui)
        If Not IsArray($cGui) Then
            Return 0
        EndIf
          If $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd", $cGui[4])
          If $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd", $cGui[4])
    EndFunc
    ;-----------------------------------------------------------------------------------------------------------------------
    Alles anzeigen
  • Automatische DriveSpace Kontrolle

    • casi4712
    • 15. Juli 2022 um 15:35

    Hallo allerseits,

    habe schon wieder mal ein Problem mit der adlibRegister Funktion, keine Ahnung was ich dabei immer vergesse. Ich habe folgendes Problem, ich habe in einem Scipt eine Funktion die ein Label einblenden soll, sobald ein bestimmter Speicherstand erreicht ist auf dem System Laufwerk. Das funktioniert auch, aber er aktualisiert es anscheinend nicht, sieht jemand den Fehler?

    AutoIt
    ; includes ---------------------------------------------------------------------
    #include-once
    
    #include "Services.au3"
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    #include <StringConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    
    ; opt ----------------------------------------------------------------------
    Opt('MustDeclareVars', 1)
    
    ;declaration ------------------------------------------------------------------
    ;GUI Variables
    Global $ActiveCheck, $result
    Global $ARRAY_COLOR_TOP_MIN[3] = [36, 65, 142]
    Global $ARRAY_COLOR_TOP_MAX[3] = [11, 42, 122]
    Global $RBOX_EVENT_CLOSE  = 1
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    Global $SubBack = 0xEAF0E2
    
    
    global $var_system_drive = StringLeft(@WindowsDir, 2); SystemDrive auslesen
    Global Const $drive = StringLeft( $var_system_drive, 3)
    global $iFreeSpace = ""
    global $fslabel = ""
    global $LabelSpace
    
    ;AdLibRegisterg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    AdlibRegister('_createLabels', 5000)
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    ; processing --------------------------------------------------------------------------------------------------
    
    Global $hGui = RBoxCreate("Test", 840, 610)
    
    ;FunctionCalls---------------------------------------------------------------------------------------------------------------------------------------------------
    _Testspace()
    _createLabels()
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    
    ;Main Logic-------------------------------------------------------------------------------------------------------------------------------------------------------
    While True
        CheckX($hGui, $RBOX_EVENT_CLOSE, "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0xA3A3A3)", "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0x555555)")
    
       local $gMsg = GUIGetMsg()
        Switch $gMsg
            Case $GUI_EVENT_CLOSE, $RBOX_EVENT_CLOSE
                GUIDelete($hGui)
                AdlibUnRegister('_createLabels')
                Exit
    
            Case  $labelSpace
             global $iFreeSpace = DriveSpaceFree(@HomeDrive & "\")
               MsgBox($MB_SYSTEMMODAL, "", "Free Space: " & $Free & " GB")
          
        EndSwitch
    
    WEnd
        
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    Func _createLabels()
    
        $labelSpace = GUICtrlCreateLabel($FSlabel, 150, 340, 350, 150)
          GUICtrlSetColor(-1, 0xF00404) ; red
          GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)      
          
    EndFunc
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    Func _Testspace()
    global $fslabel = ""
    Global $free = DriveSpaceFree($drive) / 1024
    
        if $free < 21 Then; Schwellwert in GB
           $fslabel = "Drive Space auf System-Laufwerk wird knapp !!!"
        else
           $fslabel = ""
        endif
      ;MsgBox(0, "Drive Free Space For " & $drive, $free)
    EndFunc
    ;----------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    
    
    
    ;GUI STYLE--------------------------------------------------------------------------------------------------------------------------------------------------------
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    Func RBoxCreate($Title, $width, $height, $left = -1, $top = -1, $show = 1)
        Local $GUI = GUICreate($Title, $width, $height, $left, $top, $WS_POPUP)
        ;GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
             GUICtrlSetState(-1, $GUI_DISABLE)
        GUISetBkColor($GUIBKCOLOR, $GUI)
         ;_GuiRoundCorners($GUI,0,0,$ROUNDES,$ROUNDES)
        $RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X', $width - 20, 3, 25, 25)
        GUICtrlSetCursor($RBOX_EVENT_CLOSE, 0)
        GUICtrlSetBkColor($RBOX_EVENT_CLOSE, -2)
        GUICtrlSetFont($RBOX_EVENT_CLOSE, 15, 800)
        GUICtrlSetColor($RBOX_EVENT_CLOSE, 0x555555)
    
        $Title &= " "
        Local $hTitle = GUICtrlCreateLabel($Title, 0, 0, $width - 20, 26, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont($hTitle, 17, 400, 0, "Consolas")
        GUICtrlSetBkColor($hTitle, -2)
        Local $Graphic = GUICtrlCreateGraphic(0, 0, $width, 25)
        GUICtrlSetState($Graphic, $Gui_DISABLE)
        ;GradientFill($Graphic, 0, 0, $width, 25, $ARRAY_COLOR_TOP_MIN, $ARRAY_COLOR_TOP_MAX)
        If $show = 1 Then GUISetState(@SW_SHOW, $GUI)
    
        Return $GUI
    EndFunc
    
    
    
    Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
        Local $cGui = GUIGetCursorInfo($hGui)
        If Not IsArray($cGui) Then
            Return 0
        EndIf
          If $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd", $cGui[4])
          If $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd", $cGui[4])
    EndFunc
    ;-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    Alles anzeigen

    Vielen Dank i.V. und

    ein schönes Wochenende

  • Editfeld updaten

    • casi4712
    • 28. Juni 2022 um 11:37

    Ja richtig, dass meinte ich so Mombi, @MO, doch es funktioniert tatsächlich, das war keinesfalls von mir arrogant gemeint gwesen, ich sehe durchaus den Wert Deines Beitrages mit den Array GUIS, zuächst wirkt es kurz unübersichtlich, aber das relativierts sich dann. Der wesentliche Hauptvorteil scheint auch zusein, dass die Elemente der HauptGUI unterschiedlich benutzbar sind.

    Noch mals vielen Dank an alle Helfer

  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 20:13

    Ok dann bedank ich mich noch mal abschliessend, und wo findet man nun solche essentiellen Erkenntnisse wie, das FileOpen nur Readonly liest?

    schönen Abend noch

    lf

    Chris

  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 14:33

    Hey cool MOombas dass Du noch dran gedacht hast, irgend wie hatte ich ja schon son Berrechtigungsding befürchtet, aber jetzt funktioniert es.


    Recht herzlichen Dank, tut mir echt leid dass ich immer mit so Hammerdingern komme, dachte erst ist bestimmt eher ne simplere Geschichte, wünsche allen Helfern noch eine


    angenehme Woche

  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 11:46

    Oh moment, wurde vorhin aufgehalten, check ich gleich aus;)

    2min later...

    so jetzt gibbet zumindest nen Lebenszeichen, Datei konnte nicht gespeichert werden...Is doch wie verhext

  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 10:43

    Dachte doppelt hält besser :)) ne Spaß bei Seite, war beim rumprobieren reingekommen, aber auch einfach gehts nicht

    guten Morgen und lg


    Chris

  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 10:08

    So um noch mal auf meine Version zurückzukommen, hier ist eine mit SimpelGUI, warum funktioniert FileWrite nicht, ChexX und sone Scherze können nun ausgeschlossen werden?

    AutoIt
    ; Script Start - Add your code below here
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <FileConstants.au3>
    #include <MsgBoxConstants.au3>
    #include <WinAPIFiles.au3>
    #include "Services.au3"
    #include <GDIPlus.au3>
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    #include <StringConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <date.au3>
    #include <EditConstants.au3>
    
    
    
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    Global $SubBack = 0xEAF0E2
    Global $nMSG
    
    ;MAINLOGIC
    global $Form1 = GUICreate("TEST GUI", 173, 126, 192, 124)
    global $Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25)
    GUISetState(@SW_SHOW)
    
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
    
             Case $Button1
                _form3()
    
        EndSwitch
    WEnd
    
    
    
    ;Form3 Config1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _Form3()
        ;local $file = FileOpen("C:\Program Files\Mozilla Firefox\confs\firefox_ext.cfg")
        local $file = FileOpen("C:\test.txt")
        local $Form3 = GUICreate("Subform", 450, 425, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) ;Creates the GUI window
       ; local $iEdit = GUICtrlCreateEdit(FileRead($file) & @CRLF & "Another Line", 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
         global $iEdit = GUICtrlCreateEdit(FileRead($file), 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
        local $hButton = GUICtrlCreateButton("Speichern", 160, 400, 107, 25, $WS_GROUP)
    
          GUICtrlSetBkColor(-1, $SubBack)
          GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
          GUICtrlSetLimit(-1, 0xFFFFFF)
          ControlClick($Form3, "", $iEdit)
          GUISetState(@SW_SHOW) ;Shows the GUI window
          FileClose($file)
    
     While 2
        local $mMsg = GUIGetMsg()
        Switch $mMsg
        Case $GUI_EVENT_CLOSE
          GUIDelete($Form3)
          GUISetState(@SW_ENABLE, $Form3)
          Return
    
          Case $hButton
               Filewrite($file, GUICtrlRead($iEdit))
               FileWrite($file, GuiCtrlRead($IEdit))
                MsgBox(0,"Fertig!","wurde gespeichert!.")
                FileClose($file)
    
        EndSwitch
      WEnd
     EndFunc
    Alles anzeigen
  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 08:56

    Ich findes das auch durchaus eine interessante Technik, hatte mir das gestern noch mal genauer angeschaut, und ich kann mir gut vorstellen, bei nächsten "Projekte" so meine GUIS zu hinterlegen. Habe das schon gesehen, keine Bange. Aber denke bitte daran, auch wenns hier nicht klar wurde, das ist nur ein Mini Teilmodul, für ein bereits weit über 1000 Zeilen enthaltenes Gesammt Sccript, dass jetzt alles umschreiben zu müssen, für diese Mini Funktionalität wäre mit der linken Hand am rechten Ohr gekratzt, denke dass ist einsehbar. Ich nuzte hier nur eine Subgui.

    Aber auf jeden Fall danke, wie gesagt für nächste Projekte kann ich mir das gut vorstellen.


    lg und schöne Woche

    Chris

  • Editfeld updaten

    • casi4712
    • 27. Juni 2022 um 00:32

    hey, ok es funzt, dankeschön, aber nicht durch Umbennen, die Idee hatte ich auch schon, sondern durch auskommentieren. Du spielst gerne mit Arrays, habe ich mich in Autoit leider noch nicht befasst. Ist es für diese einfache Funktion nicht ein bisl überkandidelt, dass hier über 100 Zeilen Code notwendig sind? Wieso funktioniert es denn nicht einfach mit der Writefunktion, wie dein Vorredner schon sagte, und es auch an einigen Stellen beschrieben steht?

    danke noch mal

    lg


    Chris

  • Editfeld updaten

    • casi4712
    • 26. Juni 2022 um 21:29

    Hallo Mojo, wegen der checX muss ich noch mal nachschauen, benutze ich standardmässig schon lange, hatte ich nie Probleme mit, sind auch keine Variablen mehr doppelt belegt, aber ich kanns gern in eine Einfach GUI mal testweise einbetten, um Fehler auszuschliessen, ist ja schliesslich nix unmögkich. Mit Deinem Code schreibt er mir nur; include GuiCtrlonHover Error opening file, ich hatte es mir vorher aber gezogen. Das ich immer so komplizierte Probleme habe, dachte das wäre vielleicht mal ne simple Sache. Ich weiss kann auch ein Editor öffnen lassen, dachte geht vielleicht eleganter.


    LG und danke noch mal

    eine schöne Woche

  • Editfeld updaten

    • casi4712
    • 25. Juni 2022 um 22:57

    Habe jetzt die lokale Variable umgetauft in mMSG, speichert ebenfalls nicht, ist doch zum Mäusemelken.

    AutoIt
    ; includes ---------------------------------------------------------------------
    #include-once
    
    ;#include "GUIBkImage.au3"
    #include "Services.au3"
    #include <GDIPlus.au3>
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    #include <StringConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <date.au3>
    #include <EditConstants.au3>
    #RequireAdmin
    
    ; opt --------------------------------------------------------------------------
    Opt('MustDeclareVars', 1)
    
    ;declaration ------------------------------------------------------------------
    ;GUI Variables
    Global $ActiveCheck, $result
    Global $ARRAY_COLOR_TOP_MIN[3] = [36, 65, 142]
    Global $ARRAY_COLOR_TOP_MAX[3] = [11, 42, 122]
    Global $RBOX_EVENT_CLOSE  = 1
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    Global $SubBack = 0xEAF0E2
    
    ;Buttons Variables
    Global $idButton_1
    Global $idButton_200, $idButton_201
    ;Global $hEdit
    Global $nMSG
    Global $WMAC = ""
    
    ;Buttons Variables
    Global $idButton_1
    
    ; processing ---------------------------------------------------------------------------------------------
    
    Global $hGui = RBoxCreate("TEST GUI", 150, 100)
    
    ;FunctionCalls;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    _createButtons()
    _createLabels()
    
    
    ;Main Logic;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    While True
        CheckX($hGui, $RBOX_EVENT_CLOSE, "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0xA3A3A3)", "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0x555555)")
    
       local $gMsg = GUIGetMsg()
        Switch $gMsg
            Case $GUI_EVENT_CLOSE, $RBOX_EVENT_CLOSE
                GUIDelete($hGui)
        Exit
            Case $idButton_1
                _form3()
        EndSwitch
    
    WEnd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    ;Form3 Config1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _Form3()
        ;local $file = FileOpen("C:\Program Files\Mozilla Firefox\confs\firefox_ext.cfg")
        local $file = FileOpen("C:\test.txt")
        local $Form3 = GUICreate("Subform", 450, 425, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) ;Creates the GUI window
       ; local $iEdit = GUICtrlCreateEdit(FileRead($file) & @CRLF & "Another Line", 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
         local $iEdit = GUICtrlCreateEdit(FileRead($file), 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
        local $hButton = GUICtrlCreateButton("Speichern", 160, 400, 107, 25, $WS_GROUP)
    
          GUICtrlSetBkColor(-1, $SubBack)
          GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
          GUICtrlSetLimit(-1, 0xFFFFFF)
          ControlClick($Form3, "", $iEdit)
          GUISetState(@SW_SHOW) ;Shows the GUI window
          FileClose($file)
    
     While 2
        local $mMsg = GUIGetMsg()
        Switch $mMsg
        Case $GUI_EVENT_CLOSE
          GUIDelete($Form3)
          GUISetState(@SW_ENABLE, $Form3)
          Return
    
          Case $hButton
               Filewrite($file, GUICtrlRead($iEdit))
                MsgBox(0,"Fertig!","wurde gespeichert!.")
    
        EndSwitch
      WEnd
     EndFunc
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; functions --------------------------------------------------------------------
    ;BUTTONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _createButtons()
        $idButton_1 = GUICtrlCreateButton("CONFIG", 10, 55, 100, 20)
                    GUICtrlSetTip( -1, "Config anpassen")
    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Func _createLabels()
    EndFunc
    
    
    
    
    
    
    
    
    
    
    
    
    ;GUI STYLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Func RBoxCreate($Title, $width, $height, $left = -1, $top = -1, $show = 1)
        Local $GUI = GUICreate($Title, $width, $height, $left, $top, $WS_POPUP)
        GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
             GUICtrlSetState(-1, $GUI_DISABLE)
        GUISetBkColor($GUIBKCOLOR, $GUI)
        $RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X', $width - 20, 3, 25, 25)
        GUICtrlSetCursor($RBOX_EVENT_CLOSE, 0)
        GUICtrlSetBkColor($RBOX_EVENT_CLOSE, -2)
        GUICtrlSetFont($RBOX_EVENT_CLOSE, 15, 800)
        GUICtrlSetColor($RBOX_EVENT_CLOSE, 0x555555)
    
        $Title &= " "
        Local $hTitle = GUICtrlCreateLabel($Title, 0, 0, $width - 20, 26, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont($hTitle, 17, 400, 0, "Consolas")
        GUICtrlSetBkColor($hTitle, -2)
        Local $Graphic = GUICtrlCreateGraphic(0, 0, $width, 25)
        GUICtrlSetState($Graphic, $Gui_DISABLE)
        If $show = 1 Then GUISetState(@SW_SHOW, $GUI)
    
        Return $GUI
    EndFunc
    
    
    
    Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
        Local $cGui = GUIGetCursorInfo($hGui)
        If Not IsArray($cGui) Then
            Return 0
        EndIf
          If $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd", $cGui[4])
          If $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd", $cGui[4])
    EndFunc
    Alles anzeigen
  • Editfeld updaten

    • casi4712
    • 25. Juni 2022 um 22:47

    also an dem Pfad sollte es nicht liegen, das hatte ich auch schon überprüft, indem ich eine txt nach c:\test.txt versucht hatte, der selbe Effekt. Das andere schau ich gerade mal und vergebe dann einen anderen Namen.

    lg


    chris

  • Editfeld updaten

    • casi4712
    • 25. Juni 2022 um 20:25

    hm, also dass kann es auch nicht sein, hab jetzt alle Variablen in der Funktion auf Local gesetzt.

    AutoIt
    #include-once
    
    ;#include "GUIBkImage.au3"
    #include "Services.au3"
    #include <GDIPlus.au3>
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    #include <StringConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <date.au3>
    #include <EditConstants.au3>
    #RequireAdmin
    
    ; opt --------------------------------------------------------------------------
    Opt('MustDeclareVars', 1)
    
    ;declaration ------------------------------------------------------------------
    ;GUI Variables
    Global $ActiveCheck, $result
    Global $ARRAY_COLOR_TOP_MIN[3] = [36, 65, 142]
    Global $ARRAY_COLOR_TOP_MAX[3] = [11, 42, 122]
    Global $RBOX_EVENT_CLOSE  = 1
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    Global $SubBack = 0xEAF0E2
    
    ;Buttons Variables
    Global $idButton_1
    Global $idButton_200, $idButton_201
    Global $hEdit
    Global $nMSG
    Global $WMAC = ""
    
    ;Buttons Variables
    Global $idButton_1
    
    ; processing ---------------------------------------------------------------------------------------------
    
    Global $hGui = RBoxCreate("TEST GUI", 150, 100)
    
    ;FunctionCalls;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    _createButtons()
    _createLabels()
    
    
    ;Main Logic;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    While True
        CheckX($hGui, $RBOX_EVENT_CLOSE, "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0xA3A3A3)", "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0x555555)")
    
       local $gMsg = GUIGetMsg()
        Switch $gMsg
            Case $GUI_EVENT_CLOSE, $RBOX_EVENT_CLOSE
                GUIDelete($hGui)
        Exit
            Case $idButton_1
                _form3()
        EndSwitch
    
    WEnd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    ;Form3 Config1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _Form3()
        local $file = FileOpen("C:\Program Files\Mozilla Firefox\confs\firefox_ext.cfg")
        local $Form3 = GUICreate("Subform", 450, 425, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) ;Creates the GUI window
        local $iEdit = GUICtrlCreateEdit(FileRead($file) & @CRLF & "Another Line", 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
        local $hButton = GUICtrlCreateButton("Speichern", 160, 400, 107, 25, $WS_GROUP)
    
          GUICtrlSetBkColor(-1, $SubBack)
          GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
          GUICtrlSetLimit(-1, 0xFFFFFF)
          ControlClick($Form3, "", $iEdit)
          GUISetState(@SW_SHOW) ;Shows the GUI window
          FileClose($file)
    
     While 2
        local $nMsg = GUIGetMsg()
        Switch $nMsg
        Case $GUI_EVENT_CLOSE
          GUIDelete($Form3)
          GUISetState(@SW_ENABLE, $Form3)
          Return
    
          Case $hButton
               Filewrite($file, GUICtrlRead($iEdit))
                MsgBox(0,"Fertig!","wurde gespeichert!.")
    
        EndSwitch
      WEnd
     EndFunc
     
     
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; functions --------------------------------------------------------------------
    ;BUTTONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _createButtons()
        $idButton_1 = GUICtrlCreateButton("CONFIG", 10, 55, 100, 20)
                    GUICtrlSetTip( -1, "Config anpassen")
    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Func _createLabels()
    EndFunc
    
    
    
    
    
    
    
    
    
    
    
    
    ;GUI STYLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Func RBoxCreate($Title, $width, $height, $left = -1, $top = -1, $show = 1)
        Local $GUI = GUICreate($Title, $width, $height, $left, $top, $WS_POPUP)
        GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
             GUICtrlSetState(-1, $GUI_DISABLE)
        GUISetBkColor($GUIBKCOLOR, $GUI)
        $RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X', $width - 20, 3, 25, 25)
        GUICtrlSetCursor($RBOX_EVENT_CLOSE, 0)
        GUICtrlSetBkColor($RBOX_EVENT_CLOSE, -2)
        GUICtrlSetFont($RBOX_EVENT_CLOSE, 15, 800)
        GUICtrlSetColor($RBOX_EVENT_CLOSE, 0x555555)
    
        $Title &= " "
        Local $hTitle = GUICtrlCreateLabel($Title, 0, 0, $width - 20, 26, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont($hTitle, 17, 400, 0, "Consolas")
        GUICtrlSetBkColor($hTitle, -2)
        Local $Graphic = GUICtrlCreateGraphic(0, 0, $width, 25)
        GUICtrlSetState($Graphic, $Gui_DISABLE)
        If $show = 1 Then GUISetState(@SW_SHOW, $GUI)
    
        Return $GUI
    EndFunc
    
    
    
    Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
        Local $cGui = GUIGetCursorInfo($hGui)
        If Not IsArray($cGui) Then
            Return 0
        EndIf
          If $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd", $cGui[4])
          If $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd", $cGui[4])
    EndFunc
    Alles anzeigen

    schönen Abend noch und Danke

  • Editfeld updaten

    • casi4712
    • 25. Juni 2022 um 12:17

    So dann checke ich mal wieder ein, das Statement was Du mir nanntest klang ja auch logisch, hatte das jetzt eben mal zu meiner Edit GUI hinzugefügt, aber der Speichererfolg ist leider nur mässig:( Der Coder schaut so aus (nur die Edit GUI):

    AutoIt
    ;Form3 Config1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _Form3()
        Global $file = FileOpen("C:\Program Files\Mozilla Firefox\confs\firefox_ext.cfg")
        Global $Form3 = GUICreate("Subform", 450, 425, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) ;Creates the GUI window
        Global $iEdit = GUICtrlCreateEdit(FileRead($file) & @CRLF & "Another Line", 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
        Global $hButton = GUICtrlCreateButton("Speichern", 160, 400, 107, 25, $WS_GROUP)
    
          GUICtrlSetBkColor(-1, $SubBack)
          GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
          GUICtrlSetLimit(-1, 0xFFFFFF)
          ControlClick($Form3, "", $iEdit)
          GUISetState(@SW_SHOW) ;Shows the GUI window
          FileClose($file)
    
     While 2
        $nMsg = GUIGetMsg()
        Switch $nMsg
        Case $GUI_EVENT_CLOSE
          GUIDelete($Form3)
          GUISetState(@SW_ENABLE, $Form3)
          Return
    
          Case $hButton
               Filewrite($file, GUICtrlRead($iEdit))
                MsgBox(0,"Fertig!","wurde gespeichert!.")
    
        EndSwitch
      WEnd
     EndFunc
    Alles anzeigen
  • Editfeld updaten

    • casi4712
    • 24. Juni 2022 um 14:59

    okidoki, vielen Dank, checke ich gleich mal aus

  • Editfeld updaten

    • casi4712
    • 24. Juni 2022 um 11:24

    HAllo liebe Forengemeinde,

    sitze jetzt schon geraumezeit daran, ein definiertes TXT file auf Buttonclick zu öffnen , dann editierbar zu machen (ist es ja schon) und dann nach der Möglichkeit, per neuem Button das file upzudaten. Die Hilfe konnte mir dabei auch nicht unbedingt behilflich sein, beim Stichwort update ging es dann lediglich zu einer Tabelle, aber keine entsprechenden Beispiele. Also was ich möchte, ganz simpel, nur ein Button der mir das angezeigte abspeichert. Weiss da einer genauerers? mein Code bezüglich dessen schaut so aus:

    AutoIt
    ; includes ---------------------------------------------------------------------
    #include-once
    
    ;#include "GUIBkImage.au3"
    #include "Services.au3"
    #include <GDIPlus.au3>
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    #include <StringConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <date.au3>
    #include <EditConstants.au3>
    #RequireAdmin
    
    ; opt --------------------------------------------------------------------------
    Opt('MustDeclareVars', 1)
    
    ;declaration ------------------------------------------------------------------
    ;GUI Variables
    Global $ActiveCheck, $result
    Global $ARRAY_COLOR_TOP_MIN[3] = [36, 65, 142]
    Global $ARRAY_COLOR_TOP_MAX[3] = [11, 42, 122]
    Global $RBOX_EVENT_CLOSE  = 1
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    Global $SubBack = 0xEAF0E2
    
    ;Buttons Variables
    Global $idButton_1
    Global $idButton_200, $idButton_201
    Global $hEdit
    Global $nMSG
    Global $WMAC = ""
    
    ;Buttons Variables
    Global $idButton_1
    
    ; processing ---------------------------------------------------------------------------------------------
    
    Global $hGui = RBoxCreate("TEST GUI", 150, 100)
    
    ;FunctionCalls;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    _createButtons()
    _createLabels()
    
    
    ;Main Logic;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    While True
        CheckX($hGui, $RBOX_EVENT_CLOSE, "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0xA3A3A3)", "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0x555555)")
    
       local $gMsg = GUIGetMsg()
        Switch $gMsg
            Case $GUI_EVENT_CLOSE, $RBOX_EVENT_CLOSE
                GUIDelete($hGui)
        Exit
            Case $idButton_1
                _form3()
        EndSwitch
    
    WEnd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    ;Form3 Config1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _Form3()
        Global $file = FileOpen("C:\Program Files\Mozilla Firefox\confs\firefox_ext.cfg")
        Global $Form3 = GUICreate("Subform", 450, 425, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME)) ;Creates the GUI window
        Global $iEdit = GUICtrlCreateEdit(FileRead($file) & @CRLF & "Another Line", 0, 0, 500, 400, $ES_WANTRETURN + $WS_VSCROLL + $ES_AUTOVSCROLL + $ES_MULTILINE + $WS_TABSTOP)
    
          GUICtrlSetBkColor(-1, $SubBack)
          GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
          GUICtrlSetLimit(-1, 0xFFFFFF)
          ControlClick($Form3, "", $iEdit)
          GUISetState(@SW_SHOW) ;Shows the GUI window
          FileClose($file)
    
     While 2
        $nMsg = GUIGetMsg()
        Switch $nMsg
        Case $GUI_EVENT_CLOSE
          GUIDelete($Form3)
          GUISetState(@SW_ENABLE, $Form3)
          Return
    
         ;Case $hButton
    
        EndSwitch
      WEnd
     EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; functions --------------------------------------------------------------------
    ;BUTTONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _createButtons()
        $idButton_1 = GUICtrlCreateButton("CONFIG", 10, 55, 100, 20)
                    GUICtrlSetTip( -1, "Config anpassen")
    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Func _createLabels()
    EndFunc
    
    
    
    
    
    
    ;GUI STYLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    Func RBoxCreate($Title, $width, $height, $left = -1, $top = -1, $show = 1)
        Local $GUI = GUICreate($Title, $width, $height, $left, $top, $WS_POPUP)
        GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
             GUICtrlSetState(-1, $GUI_DISABLE)
        GUISetBkColor($GUIBKCOLOR, $GUI)
        $RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X', $width - 20, 3, 25, 25)
        GUICtrlSetCursor($RBOX_EVENT_CLOSE, 0)
        GUICtrlSetBkColor($RBOX_EVENT_CLOSE, -2)
        GUICtrlSetFont($RBOX_EVENT_CLOSE, 15, 800)
        GUICtrlSetColor($RBOX_EVENT_CLOSE, 0x555555)
    
        $Title &= " "
        Local $hTitle = GUICtrlCreateLabel($Title, 0, 0, $width - 20, 26, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont($hTitle, 17, 400, 0, "Consolas")
        GUICtrlSetBkColor($hTitle, -2)
        Local $Graphic = GUICtrlCreateGraphic(0, 0, $width, 25)
        GUICtrlSetState($Graphic, $Gui_DISABLE)
        If $show = 1 Then GUISetState(@SW_SHOW, $GUI)
    
        Return $GUI
    EndFunc
    
    
    
    Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
        Local $cGui = GUIGetCursorInfo($hGui)
        If Not IsArray($cGui) Then
            Return 0
        EndIf
          If $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd", $cGui[4])
          If $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd", $cGui[4])
    EndFunc
    
    
    
    
    
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Alles anzeigen

    Danke schon mal und allen ein schönes Weekend

    Chris

  • Windows Aktivierung

    • casi4712
    • 16. Juni 2022 um 15:56

    Cool, jetzt funktioniert es auch, recht herzlichen Dank

    lg und aschöne Restwoche noch


    Chris

  • Windows Aktivierung

    • casi4712
    • 15. Juni 2022 um 14:59

    Hallo noch mal, ist mir jetzt ein bisl peinlich, aber nach nochmaligen Testen habe ich festgestellt, dass dieses Problem noch gar nicht so richtig gelöst ist. Die Funktion ifWinActivated von Oscar liefert bei mir in hjedem Falle True auch wenn ich per slmgr windows deaktiviert habe. Es kommt immer True bei raus. Hat sich da doch ein Fehler eingeschlichen? Danke noch mal i.V.

    Hier noch mal der Code dazu:

    AutoIt
    ; includes ---------------------------------------------------------------------
    #include-once
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiCtrlSetOnHover_UDF.au3>
    #include <StaticConstants.au3>
    #include <String.au3>
    #include <WinApi.au3>
    #include <WindowsConstants.au3>
    #include <MsgBoxConstants.au3>
    #include <ButtonConstants.au3>
    
    ; opt --------------------------------------------------------------------------
    Opt('MustDeclareVars', 1)
    ; declaration ------------------------------------------------------------------
    
    Global $proc = Run ( "wmic path softwarelicensingservice get OA3xOriginalProductKey", @SystemDir, Default, $STDOUT_CHILD )
    Global $ActiveCheck, $result
    Global $ARRAY_COLOR_TOP_MIN[3] = [36, 65, 142]
    Global $ARRAY_COLOR_TOP_MAX[3] = [11, 42, 122]
    Global $RBOX_EVENT_CLOSE  = 1
    Global $ROUNDES = 20, $LastHwnd = 0
    Global $LastHwnd
    Global $GUIBKCOLOR = 0x738599
    
    ; processing --------------------------------------------------------------------------------------------------
    
    Global $hGui = RBoxCreate("TEST", 840, 600)
    
    ;FunctionCalls;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;CheckAcState()
    _IfWinActivated()
    _createLabels()
    
    
    
    ;Main Logic;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    While True
        CheckX($hGui, $RBOX_EVENT_CLOSE, "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0xA3A3A3)", "GuiCtrlSetColor(" & $RBOX_EVENT_CLOSE & ",0x555555)")
    
       local $gMsg = GUIGetMsg()
        Switch $gMsg
            Case $GUI_EVENT_CLOSE, $RBOX_EVENT_CLOSE
                GUIDelete($hGui)
                Exit
        EndSwitch
    WEnd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ; functions --------------------------------------------------------------------
    
    ;Label  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func _createLabels()
        GUICtrlCreateLabel(_IfWinActivated(), 600, 560, 250, 20)
          GUICtrlSetFont(-1, 11, 800) ; bold
    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    
    ; AktivierungsStatus;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func CheckAcState()
    global $acLabel
    _IfWinActivated()
      if _IfWinActivated() == True Then
          $ac = ""
           GUICtrlSetData($acLabel, "Der PC ist dauerhaft aktiviert") ; <<<<< ansonsten landen wir hier
      Else
          $ac = "Der PC ist nicht  aktiviert"
           GUICtrlSetData($acLabel, "Der PC ist nicht aktiviert") ; <<<<< ansonsten landen wir hier
    EndIf
    EndFunc
    
    
    
    _IfWinActivated()
     MsgBox(0, "Licencing Information", _IfWinActivated)
    
    Func _IfWinActivated()
        Local $sCommand, $iPID, $sData
        $sCommand = @ComSpec & ' /c WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE LicenseStatus=1 GET LicenseStatus | findstr "1"'
        $iPID = Run($sCommand, @ScriptDir, @SW_HIDE, 0x2)
        ProcessWait($iPID)
        Do
            $sData &= StdoutRead($iPID)
        Until @error <> 0
        Return StringLeft($sData, 1) == '1'
    
    EndFunc
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    
    
    
    
    
    ;GUI STYLE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Func RBoxCreate($Title, $width, $height, $left = -1, $top = -1, $show = 1)
        Local $GUI = GUICreate($Title, $width, $height, $left, $top, $WS_POPUP)
        GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
             GUICtrlSetState(-1, $GUI_DISABLE)
        GUISetBkColor($GUIBKCOLOR, $GUI)
        $RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X', $width - 20, 3, 25, 25)
        GUICtrlSetCursor($RBOX_EVENT_CLOSE, 0)
        GUICtrlSetBkColor($RBOX_EVENT_CLOSE, -2)
        GUICtrlSetFont($RBOX_EVENT_CLOSE, 15, 800)
        GUICtrlSetColor($RBOX_EVENT_CLOSE, 0x555555)
    
        $Title &= " "
        Local $hTitle = GUICtrlCreateLabel($Title, 0, 0, $width - 20, 26, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
        GUICtrlSetFont($hTitle, 17, 400, 0, "Consolas")
        GUICtrlSetBkColor($hTitle, -2)
        Local $Graphic = GUICtrlCreateGraphic(0, 0, $width, 25)
        GUICtrlSetState($Graphic, $Gui_DISABLE)
        ;GradientFill($Graphic, 0, 0, $width, 25, $ARRAY_COLOR_TOP_MIN, $ARRAY_COLOR_TOP_MAX)
        If $show = 1 Then GUISetState(@SW_SHOW, $GUI)
    
        Return $GUI
    EndFunc
    
    
    
    Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
        Local $cGui = GUIGetCursorInfo($hGui)
        If Not IsArray($cGui) Then
            Return 0
        EndIf
          If $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd", $cGui[4])
          If $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd", $cGui[4])
    EndFunc
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    Alles anzeigen

    Mag sein dass, das jetzt mit der zusätzlichen Aktualisierungsstatus Funktion Bulshit ist, ich habe die Funktion oben erstmal testweise direkt eingesetzt, wie gesagt ist immer True.

    Danke schon mal


    lg


    chris

    Code
    Code

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™