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. Joriktos

Beiträge von Joriktos

  • ICS - Internet Connection State

    • Joriktos
    • 19. März 2013 um 16:30

    Kannst du mir sagen, wie das funktionieren würde? :)

  • ICS - Internet Connection State

    • Joriktos
    • 19. März 2013 um 15:39

    So, jetzt wird auch die Downloadgeschwindigkeit berechnet und ein Log-File im ScriptDir gespeichert.

    Kommentare hab ich noch nicht vollständig, werde ich aber noch vervollständigen und dann hier reineditieren ;)

    Source
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=Icon\ICS.ico
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=Rafael K. (Joriktos)
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #include <Constants.au3>

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

    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    Opt("TrayMenuMode", 3) ; Keine Häkchen im Tray-Menü, kein Standard-Menü.
    TraySetClick(8) ; Tray-Menü nur bei Rechtsklick öffnen.

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

    Global $sURL = "http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.3.8.1-setup.exe" ; Datei, die heruntergeladen wird um die Downloadgeschwindigkeit zu errechnen.

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

    Global $hDownload ; Handle zum Download.
    Global $iSize ; Größe der Datei, die heruntergeladen werden soll.
    Global $iSizeCompleted ; Größe der bereits heruntergeladenen Daten (in Bytes).
    Global $iSizeCompletedBefore ; Größe der bereits heruntergeladenen Daten beim letzten Check.
    Global $aSpeedAverageValues[1001] ; Hier werden die letzten 1000 Gechwindigkeits-Messwerte gespeichert. Index 0 enthält die Anzahl der bereits gemessenen Werte (Während am Anfang noch keine 1000 Messwerte vorhanden sind).
    Global $iSpeedAverage = 0 ; Die aktuelle Durchschnittsgeschwindigkeit
    Global $iSpeedAverageValueCount = 0 ; Der Index der in $aSpeedAverageValues beschrieben, beziehungsweise überschrieben werden soll.
    Global $nSpeedTimer ; Die Zeit, die zwischen 2 Messungen vergangen ist, um die Geschwindigkeit daraus zu errechnen.

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

    Global $iMinute = 60000 ; Zeit in Millisekunden, nach der die aktuelle Downloadgeschwindigkeit in den Log geschrieben wird.
    Global $nMinuteTimer = TimerInit() ; Zeitmessung um Downloadgeschwindigkeit in den Log zu schreiben.

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

    Global $bConnected ; True, wenn mit dem Internet verbunden. False, wenn nicht mit dem Internet verbunden.
    Global $bPause = False ; True, wenn gerade nichts gecheckt werden soll. False, wenn gecheckt werden soll.
    Global $iDelay = 5000 ; Zeit in Millisekunden nach der die Internetverbindung überprüft werden soll.
    Global $iPing = Ping("www.google.com") ; Wenn Ping nicht 0 ist, ist eine Verbindung zum Internet (bzw. zu google.com) vorhanden.
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de") ; Falls google.com nicht erreichbar ($iPing = 0) ist, werden noch 2 andere Websites gecheckt.

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

    If $CmdLine[0] <> 0 Then ; Falls ICS mit einem (oder mehreren) Parametern gestartet wurde:
    If StringIsDigit($CmdLine[1]) = 1 Then ; Falls der Parameter eine Ganzzahl enthält:
    $iDelay = $CmdLine[1] * 1000 ; Das angegebene Delay * 1000 nehmen (um Millisekunden zu erhalten) und in $iDelay speichern.
    EndIf
    EndIf

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

    $hLogFile = FileOpen(@ScriptDir & "\ICS.log", 9) ; Log-Datei als Handle öffnen (Wird erstellt, falls noch nicht vorhanden).
    FileWriteLine($hLogFile, "__________________________________ " & @MDAY & "." & @MON & "." & @YEAR & " __________________________________" & @CRLF & @CRLF) ; "Sessionsmarkierung" mit Datum hinzufügen.
    _Log("Started ICS.") ; In Log schreiben.
    _Log("Checkdelay: " & $iDelay / 1000 & " seconds.")

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

    Global $idTrayPause = TrayCreateItem("Pause Checking")
    TrayItemSetState($idTrayPause, $TRAY_DEFAULT)
    Global $idTrayCheck = TrayCreateItem("Start Checking")
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE)
    Global $idTrayDelay = TrayCreateItem("Delay")
    TrayCreateItem("")
    Global $idTrayShortcut = TrayCreateItem("Shortcut with Delay")
    TrayCreateItem("")
    Global $idTrayExit = TrayCreateItem("Exit")

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

    If $iPing = 0 Then ; Falls nicht zum Internet verbunden:
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    _Log("Disconnected from the Internet.")
    Else ; Falls zum Internet verbunden:
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    _Log("Connected to the Internet.")

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

    $iSize = InetGetSize($sURL)
    _DownloadStart()
    EndIf

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

    _ToolTipClose()
    _Check()

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

    Func _TrayMsg()
    $nTrayMsg = TrayGetMsg()
    Switch $nTrayMsg
    Case $idTrayDelay
    _Delay()
    Case $idTrayPause
    _Pause()
    Case $idTrayCheck
    _StartCheck()
    Case $idTrayShortcut
    _Shortcut()
    Case $idTrayExit
    InetClose($hDownload)
    _Log("Closed ICS." & @CRLF & @CRLF & @CRLF)
    FileClose($hLogFile)
    Exit
    EndSwitch
    Return
    EndFunc ;==>_TrayMsg

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

    Func _Check()
    While 1
    $iTimer = TimerInit() ; Timer initialisieren
    While TimerDiff($iTimer) < $iDelay ; Solange ausführen, bis der Timer das Delay erreicht hat:
    _TrayMsg()

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

    If $bConnected = True Then ; Falls zum Internet verbunden:
    If InetGetInfo() = 0 Or InetGetInfo($hDownload, 2) = True Then ; Falls die Datei noch nicht geladen wird oder wenn sie fertig geladen hat:
    _DownloadStart()
    Else ; Falls die Datei am laden ist:
    $iSizeCompleted = InetGetInfo($hDownload, 0) ; Menge der bereits geladenen Daten in Bytes.
    If $iSizeCompletedBefore < $iSizeCompleted Then ; Falls immernoch der gleiche Download läuft (was Voraussetzung zum Geschwindigkeit errechnen ist), ist $iSizeCompleted größer als $iSizeCompletedBefore:
    $iSpeedAverageValueCount += 1
    If $iSpeedAverageValueCount > 1000 Then ; Falls $iSpeedAverageValueCount 1000 erreicht hat, sollen die alten Werte wieder überschrieben werden um einen aktuellen Durchschnitt zu erhalten:
    $iSpeedAverageValueCount = 1
    EndIf
    $nBPS = $iSizeCompleted / (TimerDiff($nSpeedTimer) / 1000)
    If $aSpeedAverageValues[0] <= 1000 Then
    $aSpeedAverageValues[0] = $iSpeedAverageValueCount
    $aSpeedAverageValues[$iSpeedAverageValueCount] = $nBPS
    ElseIf $aSpeedAverageValues[0] = 1000 Then
    $aSpeedAverageValues[$iSpeedAverageValueCount] = $nBPS
    EndIf
    For $i = 1 To $aSpeedAverageValues[0]
    $iSpeedAverage += $aSpeedAverageValues[$i]
    Next
    $iSpeedAverage = $iSpeedAverage / $aSpeedAverageValues[0]
    EndIf
    $iSizeCompletedBefore = $iSizeCompleted
    EndIf

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

    If TimerDiff($nMinuteTimer) > $iMinute And (Int($iSpeedAverage) / 1024) <> 0 Then
    _Log("Download speed: " & Int($iSpeedAverage / 1024) & "kb/s")
    $nMinuteTimer = TimerInit()
    EndIf
    EndIf
    WEnd

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

    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")

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

    If $bConnected = True And $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet")
    ToolTip("You're not connected to the Internet anymore.", @DesktopWidth - 283, @DesktopHeight - 70, "Connection lost", 2)
    _Log("Connection lost")
    _ToolTipClose()
    ElseIf $bConnected = False And $iPing <> 0 Then
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're now connected to the Internet.", @DesktopWidth - 238, @DesktopHeight - 70, "Connection found", 1)
    _Log("Connection found")
    $iSize = InetGetSize($sURL)
    _ToolTipClose()
    EndIf
    WEnd
    EndFunc ;==>_Check

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

    Func _Pause()
    _Log("Stopped checking.")
    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    TrayItemSetState($idTrayPause, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayCheck, $TRAY_ENABLE + $TRAY_DEFAULT)
    _ToolTipClose()
    While 1
    _TrayMsg()
    WEnd
    EndFunc ;==>_Pause

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

    Func _StartCheck()
    _Log("Started checking.")
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayPause, $TRAY_ENABLE + $TRAY_DEFAULT)
    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")
    If $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    _Log("Disconnected from the Internet.")
    Else
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    Global $iSize = InetGetSize($sURL)
    _Log("Connected to the Internet.")
    EndIf

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

    $nMinuteTimer = TimerInit()
    _ToolTipClose()
    _Check()
    EndFunc ;==>_StartCheck

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

    Func _ToolTipClose()
    $iTipTimer = TimerInit()
    While TimerDiff($iTipTimer) < 5000
    _TrayMsg()
    WEnd
    ToolTip("")
    EndFunc ;==>_ToolTipClose

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

    Func _Shortcut()
    $iShortcutDelay = $iDelay / 1000
    $sAnswer = InputBox("Delay after shortcut-start", "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iShortcutDelay = $sAnswer
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay after shortcut-start", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 150)
    EndIf
    WEnd
    FileCreateShortcut(@ScriptFullPath, @ScriptDir & "\Internet Connection State.lnk", "", $iShortcutDelay, "", @SystemDir & "\shell32.dll", "", -14)
    _Log("Created shortcut with a delay of " & $iShortcutDelay & " seconds. Saved to '" & @ScriptDir & "\Internet Connection State.lnk'.")
    Return
    EndFunc

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

    Func _Delay()
    $sAnswer = InputBox("Delay", "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iDelay = $sAnswer * 1000
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 150)
    EndIf
    WEnd
    _Log("Checkdelay set to " & $iDelay / 1000 & " seconds.")
    Return
    EndFunc ;==>_Delay

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

    Func _Log($sLine)
    FileWriteLine($hLogFile, @HOUR & ":" & @MIN & ":" & @SEC & " - " & $sLine)
    EndFunc

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

    Func _DownloadStart()
    $hDownload = InetGet($sURL, @TempDir & "\Downloadspeed.exe", 1, 1)
    $nSpeedTimer = TimerInit()
    Return
    EndFunc

    [/autoit]


    @TheShadowAE: Hast du's dir so vorgestellt? :)

  • Minecraft Server Userliste

    • Joriktos
    • 19. März 2013 um 11:51

    Okay, ich gebe dir doch nicht den gesamten MST-Code, sondern nur das für dich relevante, weil das sind inzwischen > 1300 Zeilen...

    So empfehle ich Bukkit zu starten:

    [autoit]


    Opt("WinTitleMatchMode", 2) ; Optionen für die Fenster-Titel-Erkennung => Teile des Titels sollen erkannt werden.

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

    $iRAM = 1024 ; Kannst du machen, wie du willst.
    $pPatch = "C:\Bla\Bla" ; Pfad zur Server.jar

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

    $hServerOpen = FileOpen(@TempDir & '\MST_SERVER_START.BAT', 10) ; Schreibt dir eine Batchdatei im TempDir.
    FileWrite($hServerOpen, 'title ' & @ScriptName & ' - ServerConsole' & @CRLF & 'java -Xms' & $iRAM & 'M -Xmx' & $iRAM & 'M -jar "' & $pPath & '\craftbukkit.jar"') ; Gibt deinem Konsolen-Fenster einen eindeutigen Namen und startet es mit dem vordefinierten RAM.
    FileClose($hServerOpen)
    $hServerRun = Run(@TempDir & '\MST_SERVER_START.BAT', $pPath, @SW_HIDE, BitOR($STDOUT_CHILD, $STDERR_CHILD, $STDIN_CHILD)) ; Startet den Server versteckt und gibt dir Zugriff auf die Konsolen-Streams.
    Sleep(2000) ; Damit die Batch nicht gelöscht wird, bevor sie vollständig ausgeführt wurde.
    FileDelete(@TempDir & '\MST_SERVER_START.BAT')

    [/autoit]


    Jetzt kannst du mit

    [autoit]


    ControlSend(@ScriptName & ' - ServerConsole', "", "", "list" & @CR)

    [/autoit]


    deinen Befehl "list" an die Konsole schicken. Und mit

    [autoit]


    $sConsoleOutput = StderrRead($hServerRun)

    [/autoit]


    Bekommst du die Ausgabe darauf.


    Die ganzen Stringumformungssachen musst du jetzt aber hoffentlich selbst hinbekommen.


    Gruß
    Joriktos

  • ICS - Internet Connection State

    • Joriktos
    • 18. März 2013 um 21:39

    Okay, dann ist's ja sogar nen Kompliment ;) Also ich code aber noch gar nicht so lange mit AutoIt ;)

    P.S. Ich mach das ganze morgen fertig ;)

  • ICS - Internet Connection State

    • Joriktos
    • 18. März 2013 um 12:25

    Was heißt denn da sogar?! :huh: Achwas, nimms nich ernst :thumbup:

    Okay, dann setz ich mich da mal ran ;)


    (Edit: Außerdem ist er nicht mal sooo sauber, ich hab nämlich keinerlei Kommentare ;) Faulheit lässt grüßen... :whistling: )

  • Minecraft Server Userliste

    • Joriktos
    • 18. März 2013 um 12:22

    Ich kann dir mal den Code von meinem MST senden, wenn du den durchgelesen hast, solltest du verstehen, wie es funktioniert.

  • ICS - Internet Connection State

    • Joriktos
    • 17. März 2013 um 11:53

    Geht klar, die Log-Funktion wollte ich eh noch einbauen und das mit der Downloadgeschwindigkeit sollte dann auch kein Problem sein :D
    Soll die dann nur in den Log geschrieben werden oder jede Minute unten angezeigt werden?

    Edit: Und in welcher Einheit möchtest du die Geschwindigkeit haben? :)

  • AutoIT Software

    • Joriktos
    • 16. März 2013 um 20:13

    Ich empfehle mal ganz für den Anfang hauke96's Anfänger-Tutorial-Reihe durchzuschauen ;) Hat mir sehr geholfen :)

    https://autoit.de/index.php?page=Thread&amp;threadID=31957

  • @scriptdir schlägt nach Wechsel des Laufwerksbuchstabens (in laufender exe) fehl

    • Joriktos
    • 14. März 2013 um 12:08

    Aaaaaaah, gut, dann hab ich das wohl übersehen, war auch schon etwas müde ;)

  • @scriptdir schlägt nach Wechsel des Laufwerksbuchstabens (in laufender exe) fehl

    • Joriktos
    • 14. März 2013 um 01:00

    Also wenn es wirklich immer L und N ist, dann kannst du doch auch den vollen Pfad verwenden, oder habe ich da etwas falsch verstanden?

  • Script schreibt keine Registry-Einträge

    • Joriktos
    • 13. März 2013 um 21:57

    Bau einfach ein

    [autoit]


    MsgBox(0, "", @error)

    [/autoit]


    direkt nach dem RegWrite ein. Den Rest brauchst du nicht ;)
    (Oder ein ConsoleWrite anstatt der MsgBox)

  • ICS - Internet Connection State

    • Joriktos
    • 13. März 2013 um 15:09

    Guten Mittag, liebe AutoIt'ler,

    mir war langweilig und da habe ich mir ein kleines Skript geschrieben, welches in gewissem Abstand checkt, ob man eine Verbindung zum Internet hat oder eben nicht.
    Außerdem wird jedes mal für 5 Sekunden eine kleine Meldung rechts unten angezeigt, wenn dieser Status wechselt.
    Es gibt keine GUI, nur ein Tray-Icon (+Tray-Menü), über das man alles steuern kann.
    Wenn man das Programm mit einer Zahl als Parameter startet, wird diese Zeit als Delay voreingestellt.


    Ich habe das Script und das Icon in einer .zip angehängt.

    Funktionen

    - Überprüfung pausieren
    - Alle x Sekunden checken (Delay)
    - Verknüpfung erstellen lassen (Voreingestellter Zeit-Parameter)

    Source
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=Icon\ICS.ico
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=Rafael K. (Joriktos)
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

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

    #include <Constants.au3>

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

    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    Opt("TrayMenuMode", 3)
    TraySetClick(8)

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

    Global $bConnected
    Global $bPause = False
    Global $iDelay = 5000
    Global $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")

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

    If $CmdLine[0] <> 0 Then
    If StringIsDigit($CmdLine[1]) = 1 Then
    $iDelay = $CmdLine[1] * 1000
    EndIf
    EndIf

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

    Global $idTrayPause = TrayCreateItem("Pause Checking")
    TrayItemSetState($idTrayPause, $TRAY_DEFAULT)
    Global $idTrayCheck = TrayCreateItem("Start Checking")
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE)
    Global $idTrayDelay = TrayCreateItem("Delay")
    TrayCreateItem("")
    Global $idTrayShortcut = TrayCreateItem("Shortcut with Delay")
    TrayCreateItem("")
    Global $idTrayExit = TrayCreateItem("Exit")

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

    If $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    Else
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    EndIf

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

    _ToolTipClose()
    _Check()

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

    Func _TrayMsg()
    $nTrayMsg = TrayGetMsg()
    Switch $nTrayMsg
    Case $idTrayDelay
    _Delay()
    Case $idTrayPause
    _Pause()
    Case $idTrayCheck
    _StartCheck()
    Case $idTrayShortcut
    _Shortcut()
    Case $idTrayExit
    Exit
    EndSwitch
    Return
    EndFunc ;==>_TrayMsg

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

    Func _Check()
    While 1
    $iTimer = TimerInit()
    While TimerDiff($iTimer) < $iDelay
    _TrayMsg()
    WEnd

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

    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")

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

    If $bConnected = True And $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet")
    ToolTip("You're not connected to the Internet anymore.", @DesktopWidth - 283, @DesktopHeight - 70, "Connection lost", 2)
    _ToolTipClose()
    ElseIf $bConnected = False And $iPing <> 0 Then
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're now connected to the Internet.", @DesktopWidth - 238, @DesktopHeight - 70, "Connection found", 1)
    _ToolTipClose()
    EndIf
    WEnd
    EndFunc ;==>_Check

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

    Func _Pause()
    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    TrayItemSetState($idTrayPause, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayCheck, $TRAY_ENABLE + $TRAY_DEFAULT)
    _ToolTipClose()
    While 1
    _TrayMsg()
    WEnd
    EndFunc ;==>_Pause

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

    Func _StartCheck()
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayPause, $TRAY_ENABLE + $TRAY_DEFAULT)
    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")
    If $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    Else
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    EndIf

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

    _ToolTipClose()
    _Check()
    EndFunc ;==>_StartCheck

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

    Func _ToolTipClose()
    $iTipTimer = TimerInit()
    While TimerDiff($iTipTimer) < 5000
    _TrayMsg()
    WEnd
    ToolTip("")
    EndFunc ;==>_ToolTipClose

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

    Func _Shortcut()
    $iShortcutDelay = $iDelay / 1000
    $sAnswer = InputBox("Delay after shortcut-start", "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iShortcutDelay = $sAnswer
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay after shortcut-start", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 150)
    EndIf
    WEnd
    FileCreateShortcut(@ScriptFullPath, @ScriptDir & "\Internet Connection State.lnk", "", $iShortcutDelay, "", @SystemDir & "\shell32.dll", "", -14)
    Return
    EndFunc

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

    Func _Delay()
    $sAnswer = InputBox("Delay", "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iDelay = $sAnswer * 1000
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 150)
    EndIf
    WEnd
    Return
    EndFunc ;==>_Delay

    [/autoit]


    Gruß
    Joriktos

    Dateien

    Internet Connection State.zip 17,48 kB – 426 Downloads
  • Das 7 Byte Programm

    • Joriktos
    • 10. März 2013 um 12:17

    Jungs, ihr seid genial! :D

  • SciTe: AU3Check deaktivieren ?

    • Joriktos
    • 10. März 2013 um 02:16

    Damn... Ich bin wohl doch schon etwas müde ;D
    Tut mir leid, dass ich hier falsche Informationen verbreite :D

    Also dann geh ich mich lieber mal auf's Ohr hauen, gute Nacht, liebe AutoIt'ler ;)

  • SciTe: AU3Check deaktivieren ?

    • Joriktos
    • 10. März 2013 um 02:12

    Also die neueste Stable-Version ist 3.3.8.1 ;) Ich kann zwar grade nicht testen, ob es damit geht, aber du kannst es mal versuchen.
    Ansonsten empfehle ich (wenn möglich) die Variablen einfach auf normalem Wege zu deklarieren. Wofür brauchst du es denn mit Assign()?

    Edit: Ob man AU3Check deaktivieren kann, weiß ich allerdings nicht.
    Siehe minx' Post, er war wohl etwas schneller ;)

    Gruß
    Joriktos

  • Singleton funktioniert nicht :(

    • Joriktos
    • 27. Februar 2013 um 14:24
    Zitat von AspirinJunkie

    Du hast Recht. Ich habe in der Eile nicht gesehen, dass du auf " >1" prüfst. Entschuldige bitte.

    Ist schon okay ;) Ich hatte mir selbst auch mal viele Gedanken dazu gemacht, weil ich mehrere Instanzen erlauben wollte, aber die Konsolenfenster, auf die dann im späteren Programmverlauf zugegriffen werden soll natürlich verschiedene Namen gebraucht haben, und dann habe ich so die Instanznummer herausgefunden ;)

  • Singleton funktioniert nicht :(

    • Joriktos
    • 27. Februar 2013 um 12:37

    ProcessExist() funktioniert nicht, da der Prozess ja immer existiert, sobald du das Programm startest.
    Aber okay, damit hast du Recht, das kann man besser lösen.

  • Singleton funktioniert nicht :(

    • Joriktos
    • 26. Februar 2013 um 23:15
    Zitat von name22


    Joriktos Das ist aber eine unsaubere Lösung...

    Und warum? Sie sollte doch in fast allen Fällen funktionieren, oder?

  • AutoIt Anfänger Tutorials

    • Joriktos
    • 26. Februar 2013 um 16:26

    Klasse! :D Durch dein Video kam ich zu AutoIt :D Und erst später hab ich dieses Forum gefunden und jetzt sehe ich, dass es von dir ist ;D

    Dankeschön :)

  • Singleton funktioniert nicht :(

    • Joriktos
    • 26. Februar 2013 um 15:35

    Das geht viiiiiel kürzer ;)

    [autoit]


    $iInstance = ProcessList("DeinProgrammName.exe")
    If $iInstance[0][0] > 1 Then
    Exit
    EndIf

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

    ; Weiterer Code

    [/autoit]

    Läuft natürlich nur, wenn es schon kompiliert ist.

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™