Desktop-Text, der immer oben ist und regelmäßig aus einer Datei geladen wird

1144
Petja

Ich möchte, dass benutzerdefinierter Text immer oben auf meinem Bildschirm gedruckt wird. Ich habe Rainmeter-Software ausprobiert und konnte keine Option zum Laden von Text aus einer Datei in mein System oder auf andere Weise finden.

Was ich haben möchte, ist eine Software, die alle Sekunden über alle Fenster druckt und die Datei scannt, um die neuesten Änderungen zu drucken.

Die Idee wäre, das Live-PHP-Website-Fehlerprotokoll jede Sekunde auf meinem Bildschirm zu drucken oder wenn neue Einträge erscheinen.

1
Welches Betriebssystem? Windows XP / Vista / 7? iglvzx vor 11 Jahren 0
Es spielt keine Rolle, dass ich sowohl XP als auch 7 installiert habe und nach Bedarf installieren kann. Petja vor 11 Jahren 0

1 Antwort auf die Frage

0
Luke

Ich habe es geschafft, dies zum Laufen zu bringen, aber Sie müssen möglicherweise mit der Transparenz / Schriftgröße / Hintergrundfarbe spielen, damit sie gut lesbar ist.

Sie müssen AutoHotKey installieren und das folgende Skript ausführen: https://www.dropbox.com/s/x510z8tsxunardl/OSDTest.ahk

Es gibt einige Kommentare im Code, aber es wird kurz gesagt: 5 Zeilen vom Ende der angegebenen Protokolldatei lesen; Erstellen Sie ein Fenster und fügen Sie dieses als Text in das Fenster ein. das Fenster transparent, immer oben und "unklickbar" machen; und aktualisieren Sie den Text alle 1 Sekunden (möglicherweise muss dies erhöht werden, aber ich sehe keinen großen Leistungseinbruch - selbst mit einer 20 MB-Protokolldatei).

Um das Skript zu beenden, klicken Sie mit der rechten Maustaste auf das AutoHotKey-Symbol in der Taskleiste und wählen Sie Beenden.

Wenn meine Links defekt sind, folgt der AHK-Code:

#SingleInstance force ; Example: On-screen display (OSD) via transparent window: FileName := "C:\xampplite\apache\logs\access.log" NumLines = 5 CustomColor = FF8080 ; The transparent background color of the window, set this to something close to your text colour to avoid white highlighting  Gui +LastFound +AlwaysOnTop -Caption +ToolWindow +E0x20 ; +ToolWindow avoids a taskbar button and an alt-tab menu item. Gui, Color, %CustomColor% Gui, Font, s12 ; Set a large font size (12-point). errorTail := FileTail(FileName, NumLines) ; get the text from the file, last 5 lines Gui, Add, Text, vMyText cRed Y+0, %errorTail% ; add it, colour is Red, R5 sets 5 rows  ; choose one of these lines, first one show just the text, second one has a background for readability WinSet, TransColor, %CustomColor% 200 ; Make all pixels of this color transparent and make the text itself translucent (250) ;Winset, Transparent, 150  SetTimer, UpdateOSD, 1000 ; 1 second timer set here Gui, Show, x0 y600 NoActivate ; Set the x and y position. NoActivate avoids deactivating the currently active window. return  UpdateOSD: ; the repeated timer routine errorTail := FileTail(FileName, NumLines) ;get 5 lines GuiControl,, MyText, %errorTail% return  ; ====================================================================================================================== ; Function: Retrieve the last lines of a text file. ; AHK version: 1.1.07+ ; Parameters: ; FileName - the name of the file, assumed to be in A_WorkingDir if an absolute path isn't specified ; Lines - number of lines to read - default: 10 (like Unix) ; NewLine - new line character(s) - default: `r`n (Windows) ; Return values: ; On success: The required lines, if present ; On failure: "" ; Version: 1.0.00.00/2012-04-16/just me ; ====================================================================================================================== FileTail(FileName, Lines = 10, NewLine = "`r`n") { Static MaxLineLength := 256 ; seems to be reasonable to start with If !IsObject(File := FileOpen(FileName, "r")) Return "" Content := "" LinesLength := MaxLineLength * Lines * (InStr(File.Encoding, "UTF-16") ? 2 : 1) FileLength := File.Length BytesToRead := 0 FoundLines := 0 While (BytesToRead < FileLength) && !(FoundLines) { BytesToRead += LinesLength If (BytesToRead < FileLength) File.Pos := FileLength - BytesToRead Else File.Pos := 0 Content := RTrim(File.Read(), "`r`n") If (FoundLines := InStr(Content, NewLine, 0, 0, Lines)) Content := SubStr(Content, FoundLines + StrLen(NewLine)) } File.Close() Return Content }