Jump to content

Web Based Printer Log


mikeytown2
 Share

Recommended Posts

This makes a log file of the log file... the file stored on the printer only holds 22 entries, so this makes one big log file of all the entries on your c drive.

If you want to test it out here is a live address of a dell laser printer i found on google

http://146.6.127.19/ews/job/log.htm

This script is tested only on a 3000, the link is for a 5100

;#NoTrayIcon
#include <file.au3>
$temp = 0
Do
    InetGet("http://192.168.2.3/ews/job/log.htm", "C:\templog.html")
    $file = FileOpen("C:\templog.html", 0)
    $lineNum = 72
    $prtlog = FileOpen("C:\printlog.html", 0)
    If $prtlog = -1 Then
        FileClose($prtlog)
        $prtlog = FileOpen("C:\printlog.html", 1)
        $bar = 0
        While 1
            $line = FileReadLine($file)
            $bar = $bar + 1
            If $bar < 47 Then ContinueLoop
            FileWriteLine($prtlog, $line)
            If $bar > 71 Then
                FileClose($prtlog)
                FileOpen("C:\printlog.html", 0)
                ExitLoop
            EndIf
        WEnd
        MsgBox(0, "Dell3000", "Print Log Located At C:\printlog.html", 60)
    EndIf
    $lines = 0
    $count = -1
    While 1
        $line = FileReadLine($prtlog)
        $lines = $lines + 1
        If @error = -1 Then ExitLoop
    WEnd
    $lines = $lines - 1
    $prtline = FileReadLine($prtlog, $lines)
    $prtread = StringSplit($prtline, "<tr><td>", 1)
    $prtnum = StringSplit($prtread[2], "</td><td>", 1)
    Do
        $line = FileReadLine($file, $lineNum)
        $read = StringSplit($line, "<tr><td>", 1)
        $num = StringSplit($read[2], "</td><td>", 1)
        
        $lineNum = $lineNum - 1
        $count = $count + 1
        If $count = 20 Then
            ExitLoop
        EndIf
    Until $num[1] = $prtnum[1]
    FileClose($prtlog)
    $lineNum = 73 - $count
    If $count > 0 Then
        $prtlog = FileOpen("C:\printlog.html", 1)
        MsgBox(0, "Dell3000", "New Print Completed", 60)
        Do
            $line = FileReadLine($file, $lineNum)
            FileWriteLine($prtlog, $line)
            $lineNum = $lineNum + 1
        Until $lineNum = 73
        FileClose($prtlog)
    EndIf
    FileClose($file)
    FileDelete("C:\templog.html")
    Sleep(90000)
Until $temp = 1

I commented out the no tray to post, but I run this at startup so I don't want to see it. it runs 24/7 on my computer.

Tell me what you think.

-Mike

Edited by mikeytown2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...