Jump to content

Am I On The Right Track So Far? (script To Unwrap Emails)


Recommended Posts

Here's the deal.

At my work, we offer 'extended warranties' on certain NAS/SAN systems

We also developed a product to process the weekly logs we get from these systems to parse it into an easy to read 1 or 2 page report.

Problem is, when quoting customers, we get emails that have been forwarded to us. These emails get word-wrapped. It is our biggest enemy for this product.

I can not include an entire weekly log for security reasons (includes everything from IP addresses, to domains, to filenames, etc)

I am creating a GUI interface to parse these weekly logs - by joining together lines if they are over a certain length. To determine the length of lines - i have user enter number and press unwrap. in the bottom edit box, the output is unwrapped

Below the code you will see parts of the weekly log, i have copied sections for a general idea of various sections that get wraped. The problem with having one number to unwrapp at every time is that not all messages are wrapped the same way.

Here is my code, please check it out and tell me what you think. The reason why i have both edit boxes as read only and puling from clipboard is because if i have users copy and paste in the text into the editbox, the edit box onyl pulls in part of the weekly log. The log is over 12,000 lines long - pulling from clipboard is the only way to get all the lines into the editbox

thanks in advance!

$g_szVersion = "UnWrapper v0.4"
If WinExists($g_szVersion) Then Exit; It's already running
AutoItWinSetTitle($g_szVersion)
; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1.122 beta
; Author:        Mike Dawson <miked@zerowait.com>
;
; Script Function:
;   This script will eventually allow user to input a full wrapped weekly log
;       And it will attempt to dewrap the 
;
; ----------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <File.au3>



; == GUI generated with Koda ==
$Form1 = GUICreate("Sysconfig Unwrapper", 1006, 809, 184, 112)
$Group1 = GUICtrlCreateGroup("", 312, 18, 281, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("Insert Part of Wrapped Sysconfig Here", 10, 114, 275, 22, $SS_CENTER)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
$FIRSTSysconfigEdit = GUICtrlCreateEdit("", 6, 160, 995, 231, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_EX_CLIENTEDGE, $ES_READONLY))
GUICtrlSetData($FIRSTSysconfigEdit, "Original Sysconfig Here - copy entire weekly log and then press clipboard button")
$UnWrap = GUICtrlCreateButton("UnWrap", 614, 40, 81, 25)
$ClipBoard = GUICtrlCreateButton("ClipBoard", 186, 40, 105, 25)
GUICtrlSetTip(-1, "Get Sysconfig From Clipboard")
GUICtrlCreateLabel("Guessed Max Line Length:", 320, 42, 185, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$MaxLen = GUICtrlCreateInput("50", 512, 38, 49, 24, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetLimit($MaxLen, 3)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Unwrapped Text Here", 4, 438, 186, 26, $SS_CENTER)
GUICtrlSetFont(-1, 11, 400, 0, "Arial Black")
$SECONDSysconfigEdit = GUICtrlCreateEdit("", 6, 472, 995, 333, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_EX_CLIENTEDGE, $ES_READONLY))
GUICtrlSetData($SECONDSysconfigEdit, "Unwrapped text will go here")
$Graphic1 = GUICtrlCreateGraphic(0, 414, 1006, 2, $SS_CENTER)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)


While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $UnWrap
        If FileExists("unwrapped-config.txt") Then
            FileDelete("unwrapped-config.txt")
        EndIf
        $OriginalText = GUICtrlRead($FIRSTSysconfigEdit)
        CreateFile($OriginalText);creates the file with the sysconfig data
        JoinFileLines($MaxLen)
        ShowUnwrapped()
    ;then it will do a $RevisedText = script that returns the contents of sysconfig
    ;it will then place that in the $FirstSysconfigEdit, or maybe another GUI subwindow
    Case $msg = $ClipBoard
        GUICtrlSetData($FIRSTSysconfigEdit, ClipGet())
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit

Func CreateFile($CopyOfSysconfig)
    _FileCreate("sysconfig.txt")
    $sysconfig = FileOpen("sysconfig.txt",2) ;opens the file and erases everything so it can be overwritten
    FileWrite($sysconfig, $CopyOfSysconfig)
    FileClose($sysconfig)
EndFunc

Func JoinFileLines($MaxLength)
    _FileCreate("unwrapped-config.txt")  ;creates file to store the unwrapped text in
    $sysconfig = FileOpen("sysconfig.txt", 0);opens the file for reading this one at a time
    $unwrappedfile = FileOpen("unwrapped-config.txt",1);opens the file to appened the lines
    
    $FirstLine = FileReadLine($sysconfig)
    $SecondLine = FileReadLine($sysconfig)
    
    $FirstLineLen = StringLen($FirstLine) ;length of line
    $SecondLineLen = StringLen($SecondLine);length of line

    While 1
        If $FirstLineLen + $SecondLineLen > $MaxLength  and $FirstLineLen > $SecondLineLen Then
            $ThirdLine = FileReadLine($sysconfig);gets next third line (for doublewrapped)
            If @error Then
                    ExitLoop
                EndIf
            If StringLen($ThirdLine) + $SecondLine > $MaxLength and $SecondLineLen > StringLen($ThirdLine) Then
                FileWriteLine($unwrappedfile, $FirstLine & " " & $SecondLine & " " & $ThirdLine);puts two lines together
                $FirstLine = FileReadLine($sysconfig);gets next second line
                If @error Then
                    ExitLoop
                EndIf
            Else
                FileWriteLine($unwrappedfile, $FirstLine & " " & $SecondLine);puts two lines together
                $FirstLine = $ThirdLine;resets this if it in fact is only 2 lines wrapped
            EndIf

            $SecondLine = FileReadLine($sysconfig);gets next second line
            If @error Then
                    ExitLoop
                EndIf
        Else
                
            FileWriteLine($unwrappedfile, $FirstLine);puts First line in file
            $FirstLine = $SecondLine;replaces the first line with the second line since the first was now moved over to the new file
            $SecondLine = FileReadLine($sysconfig);gets the next line
                If @error Then
                    FileWriteLine($unwrappedfile, $FirstLine);puts second line in file if its the end of the line
                    ExitLoop
                EndIf
        EndIf
                        
        $FirstLineLen = StringLen($FirstLine) ;length of line
        $SecondLineLen = StringLen($SecondLine);length of line

    WEnd
    
    
    FileClose($sysconfig)
    FileClose($unwrappedfile)

EndFunc



Func ShowUnwrapped()
    $Unwrappedfilename = FileOpen("unwrapped-config.txt", 0)
        $Unwrapped = FileRead($Unwrappedfilename); reads total file count
        
    GUICtrlSetData($SECONDSysconfigEdit, $Unwrapped)

    FileClose($Unwrappedfilename)
EndFunc

--------------------

Below are parts of the weeky log that are wrapped (replaced some sensitive characters for security):

0: Maxtor   4G160J8U66     G8CK 136.0GB 512B/sect
(G80HAB##)
                  1: Maxtor   4G160J8U66       G8CK 136.0GB 512B/sect
(G80H87##)
                  2: Maxtor   4G160J8U66       G8CK 136.0GB 512B/sect
(G80GEW##)


IP Address     State   Last Polled                Avg RTT Calls
Errs
------------------------------------------------------------------------
-------
10.XXX.XX.X   UP      Sat Apr 22 22:05:00 EDT 2006     2  6282
21
10.XXX.XX.X   DOWN  Sun Apr 16 18:05:05 EDT 2006       2    21
20

===== MESSAGES =====
Sun Apr 16 00:00:00 EDT [kern.log.rotate:notice]: System pa1-r1-252 (ID
0033613828) is running NetApp Release 7.0.1R1
Sun Apr 16 00:38:36 EDT [auth.dc.trace.DCConnection.statusMsg:info]:
AUTH: TraceDC- Found 2 addresses using generic DNS query.
Sun Apr 16 01:00:00 EDT [kern.uptime.filer:info]:   1:00am up 157 days,
15:12 0 NFS ops, 286545234 CIFS ops, 615 HTTP ops, 0 DAFS ops, 0 FCP
ops, 177203614 iSCSI ops

Below are parts of the weeky log that are unwrapped (replaced some sensitive characters for security):

0: Maxtor   4G160J8U66     G8CK 136.0GB 512B/sect (G80HAB##)
                  1: Maxtor   4G160J8U66       G8CK 136.0GB 512B/sect (G80H87##)
                  2: Maxtor   4G160J8U66       G8CK 136.0GB 512B/sect (G80GEW##)


IP Address     State   Last Polled                Avg RTT Calls Errs
------------------------------------------------------------------------ -------
10.XXX.XX.X   UP      Sat Apr 22 22:05:00 EDT 2006     2  6282 21
10.XXX.XX.X   DOWN  Sun Apr 16 18:05:05 EDT 2006       2    21 20

===== MESSAGES =====
Sun Apr 16 00:00:00 EDT [kern.log.rotate:notice]: System pa1-r1-252 (ID 0033613828) is running NetApp Release 7.0.1R1
Sun Apr 16 00:38:36 EDT [auth.dc.trace.DCConnection.statusMsg:info]: AUTH: TraceDC- Found 2 addresses using generic DNS query.
Sun Apr 16 01:00:00 EDT [kern.uptime.filer:info]:   1:00am up 157 days, 15:12 0 NFS ops, 286545234 CIFS ops, 615 HTTP ops, 0 DAFS ops, 0 FCP ops, 177203614 iSCSI ops

Thanks guys for any help you can offer!

Link to comment
Share on other sites

  • Moderators

Found my first mistake after posting this:

JoinFileLines($MaxLen)

would be sending 10 to the function JoinFileLines()

I changed it the corected code is:

JoinFileLines(GUICtrlRead($MaxLen))
I think this might be easier than you think. I found this document that describes in detail how to do this, but I've not been able to properly create the StringRegExp for it. Maybe one of the guru's can help you out with that.
Link to comment
Share on other sites

Well if someone wants to help me work on a script to do this - if we get a script working that will unwrap the messages all the time

i'm sure that i can have my boss pay whomever for their time and energy. Won't be much, but if anyone is interested in the task, i'll be more than happy to share the logs or parts of logs to verify that the script works.

once we have something that works, it will save us a lot of time. (it also is not professional to have to request the customer send the email as an attachment so the log does not get wordwrapped and crap)

Link to comment
Share on other sites

Tell me if this is correct:

Everything above ===== MESSAGES ===== should have 80-char width and everything below will have lines that begin with date/time in the format

Sun Apr 16 00:00:00 EDT

; loop through each line of text below MESSAGES
If StringRegExp ($line, "(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)") <> 1 Then join the line with the previous line
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Well if someone wants to help me work on a script to do this - if we get a script working that will unwrap the messages all the time

i'm sure that i can have my boss pay whomever for their time and energy. Won't be much, but if anyone is interested in the task, i'll be more than happy to share the logs or parts of logs to verify that the script works.

once we have something that works, it will save us a lot of time. (it also is not professional to have to request the customer send the email as an attachment so the log does not get wordwrapped and crap)

we're all here to help, and most of the ones worth getting help from aren't looking to get paid for it. i'm sorry, i'm still a little fuzzy on exactly what the input is, and what the desired output should be. i'm going to read through your code and see if i can't write something up once i really get it.
Link to comment
Share on other sites

we're all here to help, and most of the ones worth getting help from aren't looking to get paid for it. i'm sorry, i'm still a little fuzzy on exactly what the input is, and what the desired output should be. i'm going to read through your code and see if i can't write something up once i really get it.

duh. sorry. i get it. was being retarded for a minute. i see what you're trying to do. i'm going to try a couple of things real fast, may have something for you
Link to comment
Share on other sites

duh. sorry. i get it. was being retarded for a minute. i see what you're trying to do. i'm going to try a couple of things real fast, may have something for you

it doesn't look like wordwrap should add actual line breaks to the file... if you open the file in notepad and uncheck wordwrap, does it appear the way that it should?
Link to comment
Share on other sites

  • Moderators

it doesn't look like wordwrap should add actual line breaks to the file... if you open the file in notepad and uncheck wordwrap, does it appear the way that it should?

Most email programs do, however Outlook 2003 lets you choose how many chars to start wrapping at.
Link to comment
Share on other sites

Hey all, yeah i know, most people who want to help don't want money. And thats why i love this scripting language and the community around it, bunch of great guys who have helped me out many times (just offered cash inscentive as an option seeing as how it is such a pain for us, and unwrapped (imagine having to look at roughly 15000 lines to see if they are wrapped, and having to unwrap them - i eventually made a simple autoit script that hit {home}{backspace}{space}{down} for me, and assigned it to a shortcut key on my keyboard, so i could save time

i'd say about 40% of the logs i get that i have to process are wordwrapped. Because our customers have all types of email clients and they forward them around.

I have set my email client to not wordwrap and not include forward character.

When we get emails with forward characters, thats awesome, we have no problem dewrapping them (our main program joines lines because only the first line has the forward character)

but the biggest pain is the customers who got the email wrapped, but it was sent in line, and so it wraps it like that, with no forward character.

I have used everything includeing a hex editor to look for any changes between normal paragrah returns and the wordwrapped ones. Nothing, no changes.

There is no easy algorithmic way to do this other than for the human eye to say join lines that are longer than ## number of characters long. and see if it works, if not change it and try again. Since the length can vary, there is no definitve number, 80 is the standard, but people can set that to whatever, and differant clients wrap at 80 differant ways, like if they =< 80 characters long, or just < 80 characters long. plus other odditys. (notice that these emails come from admins, so they are not standard users, they use everything from Unix and linux based email clients to 3rd party clients to Micro$oft crap.)

CyberSlug, unfortunately, the messages section takes up only 1/10th of the log, the formats change based on the section.

The reason for my code sometimes checking 3 lines is because a message can be so long it gets wrapped 3 times. While all other sections get wrapped only into two lines (because they are not as long normally)

I have rewritten the code, it is partially messed up, but still works pretty good

I attached is a longer part of the code for testing the script out (edited sections out for security reasons)

$g_szVersion = "UnWrapper v0.5"
If WinExists($g_szVersion) Then Exit; It's already running
AutoItWinSetTitle($g_szVersion)
; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.1.122 beta
; Author:        Mike Dawson <miked@zerowait.com>
; Script Function:
;   This script will eventually allow user to input a full wrapped weekly log
;       And it will attempt to dewrap the
; ----------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <File.au3>
#Include <GuiEdit.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Sysconfig Unwrapper", 1006, 835, 184, 50)
$Group1 = GUICtrlCreateGroup("", 312, 18, 281, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("Insert Part of Wrapped Sysconfig Here", 10, 114, 275, 22, $SS_CENTER)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
$FIRSTSysconfigEdit = GUICtrlCreateEdit("", 6, 160, 995, 231, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_EX_CLIENTEDGE, $ES_READONLY))
GUICtrlSetData($FIRSTSysconfigEdit, "Original Sysconfig Here - copy entire weekly log and then press clipboard button")
$UnWrap = GUICtrlCreateButton("UnWrap", 614, 40, 81, 25)
$ClipBoard = GUICtrlCreateButton("ClipBoard", 186, 40, 105, 25)
GUICtrlSetTip(-1, "Get Sysconfig From Clipboard")
GUICtrlCreateLabel("Guessed Max Line Length:", 320, 42, 185, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$MaxLen = GUICtrlCreateInput("50", 512, 38, 49, 24, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetLimit($MaxLen, 3)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Unwrapped Text Here", 4, 438, 186, 26, $SS_CENTER)
GUICtrlSetFont(-1, 11, 400, 0, "Arial Black")
$SECONDSysconfigEdit = GUICtrlCreateEdit("", 6, 472, 995, 333, BitOr($ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_EX_CLIENTEDGE, $ES_READONLY))
GUICtrlSetData($SECONDSysconfigEdit, "Unwrapped text will go here")
$Graphic1 = GUICtrlCreateGraphic(0, 425, 1006, 2, $SS_CENTER)
GUICtrlSetBkColor(-1, 0x000000)
$WrappedLenLable = GUICtrlCreateLabel("Wrapped Line Length: 1", 4, 400, 300, 14, $SS_CENTER)
$UnwrappedLenLable = GUICtrlCreateLabel("Unwrapped Line Length: 1", 4, 812, 300, 14, $SS_CENTER)
$progress = GUICtrlCreateProgress(315,90,275,12)
GUICtrlSetData($progress, 0)
GUISetState(@SW_SHOW)


While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $UnWrap
        If FileExists("unwrapped-config.txt") Then
            FileDelete("unwrapped-config.txt")
        EndIf
        If FileExists("sysconfig.txt") Then
            FileDelete("sysconfig.txt")
        EndIf
        $OriginalText = GUICtrlRead($FIRSTSysconfigEdit)
        CreateFile($OriginalText);creates the file with the sysconfig data
        JoinFileLines(GUICtrlRead($MaxLen));meat and potatoes of this program is called, this is the function call that does it all
        ShowUnwrapped();updates the bottom window
        GUICtrlSetData($progress, 0)
    Case $msg = $ClipBoard
        GUICtrlSetData($FIRSTSysconfigEdit, ClipGet())
        GUICtrlSetData($WrappedLenLable, "Wrapped Line Length: " & _GUICtrlEditGetLineCount($FIRSTSysconfigEdit));number of lines
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit



Func CreateFile($CopyOfSysconfig)
    _FileCreate("sysconfig.txt")
    $sysconfig = FileOpen("sysconfig.txt",2) ;opens the file and erases everything so it can be overwritten
    FileWrite($sysconfig, $CopyOfSysconfig)
    FileClose($sysconfig)
EndFunc


Func JoinFileLines($MaxLength)
    GUICtrlSetData($progress, 0)
    _FileCreate("unwrapped-config.txt")  ;creates file to store the unwrapped text in
    $sysconfig = FileOpen("sysconfig.txt", 0);opens the file for reading this one at a time
    $unwrappedfile = FileOpen("unwrapped-config.txt",1);opens the file to appened the lines
    
    $TotalLength = _GUICtrlEditGetLineCount($FIRSTSysconfigEdit);reads the length of the sysconfig
    $ReadLines = 0;resets the Read lines
    
    
    $FirstLine = FileReadLine($sysconfig)

    $ReadLines = $ReadLines + 1;adds 1 to read line
    GUICtrlSetData($progress, $ReadLines / $TotalLength * 100)

    $SecondLine = FileReadLine($sysconfig)
    
    $ReadLines = $ReadLines + 1;adds 1 to read line
    GUICtrlSetData($progress, $ReadLines / $TotalLength * 100)
    
    $FirstLineLen = StringLen($FirstLine) ;length of line
    $SecondLineLen = StringLen($SecondLine);length of line
    While 1
        If $FirstLineLen <= $MaxLength Then
            FileWriteLine($unwrappedfile, $FirstLine);puts First line in file
            $FirstLine = $SecondLine;replaces the first line with the second line since the first was now moved over to the new file
            $SecondLine = FileReadLine($sysconfig);gets the next line
            If @error Then
                    FileWriteLine($unwrappedfile, $FirstLine);puts First line in file
                    ExitLoop
                EndIf           
            $ReadLines = $ReadLines + 1;adds 1 to read line
            GUICtrlSetData($progress, $ReadLines / $TotalLength * 100)
        ElseIf $FirstLineLen + $SecondLineLen > $MaxLength  and $FirstLineLen >= $SecondLineLen Then
            $ThirdLine = FileReadLine($sysconfig);gets next third line (for doublewrapped)
            If @error Then
                    ExitLoop
            EndIf
            $ReadLines = $ReadLines + 1;adds 1 to read line
            If StringLen($ThirdLine) + $SecondLineLen > $MaxLength and $SecondLineLen > StringLen($ThirdLine) Then
                FileWriteLine($unwrappedfile, $FirstLine & " " & $SecondLine & " " & $ThirdLine);puts three lines together
                $FirstLine = FileReadLine($sysconfig);gets next second line
                If @error Then
                    ExitLoop
                EndIf
                $ReadLines = $ReadLines + 1;adds 1 to read line
            Else
                FileWriteLine($unwrappedfile, $FirstLine & " " & $SecondLine);puts two lines together
                $FirstLine = $ThirdLine;resets this if it in fact is only 2 lines wrapped
            EndIf
            $SecondLine = FileReadLine($sysconfig);gets next second line
            If @error Then
                ExitLoop
            EndIf
            $ReadLines = $ReadLines + 1;adds 1 to read line
            GUICtrlSetData($progress, $ReadLines / $TotalLength * 100)
        Else
            FileWriteLine($unwrappedfile, $FirstLine);puts First line in file
            $FirstLine = $SecondLine;replaces the first line with the second line since the first was now moved over to the new file
            $SecondLine = FileReadLine($sysconfig);gets the next line
            If @error Then
                    FileWriteLine($unwrappedfile, $FirstLine);puts First line in file
                    ExitLoop
                EndIf           
            $ReadLines = $ReadLines + 1;adds 1 to read line
            GUICtrlSetData($progress, $ReadLines / $TotalLength * 100)
        EndIf
        
        $FirstLineLen = StringLen($FirstLine) ;length of line
        $SecondLineLen = StringLen($SecondLine);length of line
        
    WEnd
    GUICtrlSetData($progress, $ReadLines / $TotalLength * 100)
    FileClose($sysconfig)
    FileClose($unwrappedfile)
EndFunc


Func ShowUnwrapped()
    $Unwrappedfilename = FileOpen("unwrapped-config.txt", 0)
    $Unwrapped = FileRead($Unwrappedfilename); reads total file count
    GUICtrlSetData($SECONDSysconfigEdit, $Unwrapped)
    GUICtrlSetData($UnwrappedLenLable, "Unwrapped Line Length: " & _GUICtrlEditGetLineCount($SECONDSysconfigEdit))
    FileClose($Unwrappedfilename)
EndFunc

Partial_Weekly_Log___Wrapped.txt

Link to comment
Share on other sites

Note the attached file

That is edited

don't assume that it is all of the log, there is another hundred or so sections that make up another 50 or so printable pages of data

My script worked at one point for that, but not for the message section (not in the attached file) - since the messages section is word wrapped 3 times

take a look at my code and tell me what you think/suggest

My GUI will be revised later on - its just a simple thing for now

Link to comment
Share on other sites

Note the attached file

That is edited

don't assume that it is all of the log, there is another hundred or so sections that make up another 50 or so printable pages of data

My script worked at one point for that, but not for the message section (not in the attached file) - since the messages section is word wrapped 3 times

take a look at my code and tell me what you think/suggest

My GUI will be revised later on - its just a simple thing for now

my suggestion would be to have them attach the logs instead of pasting them in, if it's their mail client that's wrapping the text.
Link to comment
Share on other sites

Yeah, that is what we do currently.

However, that is not the route we want to take.

The problem is, for our company, one customer can mean from $1000 to over $50,000 - sometimes even much more - for a small business. Our goal is to keep the customer as happy as possible.

Also, the people who make the decisions on the customer's end, and the person who contacts us is not always in charge of those units directly. So they get the email forwarded to them.

Its a big BIG challenge, but i'm chipping away at the problem. It reminds me of a HUGE calculus problem in my engineering calc course..... except staring at this problem long enough yields productive thought processes that actually create progress

(originally i was doing it all by hand without autoit)

Thanks for all the help guys so far, i'm still looking into this thing.

Link to comment
Share on other sites

Yeah, that is what we do currently.

However, that is not the route we want to take.

The problem is, for our company, one customer can mean from $1000 to over $50,000 - sometimes even much more - for a small business. Our goal is to keep the customer as happy as possible.

Also, the people who make the decisions on the customer's end, and the person who contacts us is not always in charge of those units directly. So they get the email forwarded to them.

Its a big BIG challenge, but i'm chipping away at the problem. It reminds me of a HUGE calculus problem in my engineering calc course..... except staring at this problem long enough yields productive thought processes that actually create progress

(originally i was doing it all by hand without autoit)

Thanks for all the help guys so far, i'm still looking into this thing.

How about write up a script for the customers that would take the logs, zip them up, open up email client, then do all key sends to actually insert the zipped log file and email it to you. THis way the client doesn't have to do it and you get what you want. They may end up being happier :)

Link to comment
Share on other sites

How about write up a script for the customers that would take the logs, zip them up, open up email client, then do all key sends to actually insert the zipped log file and email it to you. THis way the client doesn't have to do it and you get what you want. They may end up being happier :)

the problem with that is the variable running environment, as he said that some of his clients use linux, unix, etc... autoitscripts work via the windows api, obviously not present on other operating systems... good idea, just wouldn't work for this i don't think. also, @cass noone is going to really be able to give you a solution that works for a whole file, without having a whole file to practice parsing. especially with how different each section is.your best bet may be to actually catalog a log file, just read in the whole thing, and identify the section headers, so you know every possible section. or better yet, if you can modify the program creating the logs, have it append like an Asc(1) delimiter at the beginning of each line, so you can just read in the whole file, stringsplit() it by asc(1) Edited by cameronsdad
Link to comment
Share on other sites

Well the main thing i want to know is if my logic is correct.

The biggest thing i want it to do is to calculate that if the two lines are greater than the guessed line and the first line is greater than the second line, then subtract

for the most part my script 'works' - only a few small parts does it not work.

I guess i'll have to keep working at this myself. But thanks all for the input.

The biggest pain for us is inconviencing the customers. And the problem with sending them an automated script to handle sending us an email of the log attached, is the security. These prospective customers are running the storage networks that store allllll data for companies, any outside program could compromise the system.

Thanks again all for your help. After i finish a working version of the script i'll post it in a new thread for others to see what i did. The GUI will be fixed up and all that jazz

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