okay... I tried looking for this in the forum, but didn't stumble on it. I'm sure it's somewhere, but kinda hard to search for stuff when you're constantly being interrupted at work. Anyways.....
Okay, I'm trying to have my AHK reprocess a text file that isn't delimited properly (uses spaces to produce columns). I'm doing fine with that, but when I'm trying to reassemble the date in to an HTML table, I keep getting this error:
Quote:
Error
The following variable name contains an illegal character:
"" align="righ">"
the program will exit.
now here's the code I'm working with:
Code:
Loop, read, Warrant List (no Headers).txt, Warrant List (HTML1).htm
{
if StrLen(A_LoopReadLine) > 1 ; to skip blank lines
{
IfNotInString, A_LoopReadLine, Total ; to process lines that have 'Total' in them
{
StringLeft, Line, A_LoopReadLine, 5
IfInString, Line, %A_Space% ; check for lines that have spaces in the beginning of them.
{ ;If spaces were found. This will be the data in the table
WarNbr := SubStr(A_LoopReadLine, 09, 12)
DocNbr := SubStr(A_LoopReadLine, 24, 10)
WDoNbr := SubStr(A_LoopReadLine, 38, 10)
FinCos := SubStr(A_LoopReadLine, 55, 11)
Bonded := SubStr(A_LoopReadLine, 68, 14)
AppendStrg = `n <tr>`n <td width="20%" align="right">%WarNbr%</td>`n`n <td width="20%" align="right">%DocNbr%</td>`n`n <td width="20%" align="right">%WDoNbr%</td>`n`n <td width="20%" align="right">%FinCos%</td>`n`n <td width="20%" align="right">%Bonded%</td>`n </tr>
FileAppend,%AppendStrg%
}
else
{ ; If no spaces were found this will be the start of a new table and the 'title' row.
AppendStrg = <Table width="100%">`n <TR><TD ColSpan=5>%A_LoopReadLine%</td></tr>
FileAppend,%AppendStrg%
}
}
else
{ ; this is the section where 'Total' was found. this completes the table by placing the totals in the appropiate cells and closes the table
FinToT := SubStr(A_LoopReadLine, 54, 12)
BonToT := SubStr(A_LoopReadLine, 67, 15)
AppendStrg = `n <tr>`n <td width="20%" align="right"></td>`n`n <td width="20%" align="right"></td>`n`n <td width="20%" align="right">Total:</td>`n`n <td width="20%" align="right">%FinToT%</td>`n`n <td width="20%" align="right">%BonToT%</td>`n </tr>
FileAppend,%AppendStrg%
AppendStrg = <Table width="100%">`n <TR><td width="100%" colspan="5">%A_LoopReadLine%</td></tr>
FileAppend,%AppendStrg%
}
}
}
sample data would be this:
Code:
Lastname, MARY 1409 W Street ThatVILLE, ST 12345
008211 -01 020012089 020012089 $328.90 $0.00
008211F -01 020012089F 020012089F $514.80 $0.00
TOTAL $843.70 $0.00
Surname, MIGUEL ANGEL 4969 Downyonder DR AnyTOWN, ST 65431
200202149-01 020001725 020001725 $279.50 ** No Bond **
TOTAL $279.50 $0.00
Obviously, AHK is choking on the HTML tagging.
How do I get the HTML generation to work?
THANKS IN ADVANCE!