Sign in to follow this  
Followers 0
ylrino

Pulling Data from Html?

10 posts in this topic

Hi all, i have a project involving pulling requried datas from html files and eventually write them to excel. I have wrote a script by parsing all tags but still it cant get the resutls i want. Any suggestions :lmao: ?????

Share this post


Link to post
Share on other sites



Hi all, i have a project involving pulling requried datas from html files and eventually write them to excel. I have wrote a script by parsing all tags but still it cant get the resutls i want. Any suggestions :lmao: ?????

sample data? i mean can you attach one of the html files, and identify what data you need from it?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

sample data? i mean can you attach one of the html files, and identify what data you need from it?

Hi, i attached a screen shoot. I need to extract the information such as "Operating system" stc and place them in excel format.

I have to admit i that i am a noob when dealing with html and database related stuff. My initial thought was to write a script and parse all <@*E> within the html document but some of the information was lost in the process too. :lmao:

any suggestion?? ;)

Edited by ylrino

Share this post


Link to post
Share on other sites

Hi, i attached a screen shoot. I need to extract the information such as "Operating system" stc and place them in excel format.

I have to admit i that i am a noob when dealing with html and database related stuff. My initial thought was to write a script and parse all <@*E> within the html document but some of the information was lost in the process too. :lmao:

any suggestion?? ;)

sorry, i actually was looking to get a copy of the html to see if i could come up with a better parsing algorithm

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Maybe you don't need Belarc to extract your information - why not extract it all with AutoIT instead? The forums are full of snippets for getting most information needed. Search for Scriptomatic, WMI, etc for further hints.

Share this post


Link to post
Share on other sites

Maybe you don't need Belarc to extract your information - why not extract it all with AutoIT instead? The forums are full of snippets for getting most information needed. Search for Scriptomatic, WMI, etc for further hints.

Well, those data are in that form when given to me and i have no control. I have to extract those required data from it. Initialy i wrote a script to parse all the tags but it seems inefficient. Then i found out that when i used the "save as.." function of internet explorer to save the file in *.txt format, i was able to get a decent result. So my question now is how to convert them into txt format?? :lmao:

Share this post


Link to post
Share on other sites

Hi all, i have a project involving pulling requried datas from html files and eventually write them to excel. I have wrote a script by parsing all tags but still it cant get the resutls i want. Any suggestions :lmao: ?????

It looks like the data you are trying to extract is formatted in HTML tables. IE.au3 allows you to open a page in IE and parse the content of it using the DOM (Document Object Model). There is an example of doing this and extracting the information from a table into an AutoIt array in Post 3 in the IE Automation thread with the other examples.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

those data are in that form [belarc]. . . and i have no control

Me, too, and I'm not a big fan of opening a spreadsheet and manually entering scads of repetitive data. So here's what I do:

1) Walk to each machine and run the following compiled script from a WinRAR package:

CODE
TrayTip('Belarc Advisor', 'Installing Belarc Advisor . . . please wait . . .', 0, 1)

Run( @ScriptDir & "\advisor.exe")

WinWait("Belarc Advisor", "Welcome to the Belarc Advisor Setup program")

Sleep(2000)

WinActivate("Belarc Advisor", "Welcome to the Belarc Advisor Setup program")

Sleep(1000)

ControlClick ( "Belarc Advisor", "Welcome to the Belarc Advisor Setup program", "Button1")

WinWait("Belarc License Agreement")

Sleep(2000)

WinActivate("Belarc License Agreement")

Sleep(1000)

ControlClick ( "Belarc License Agreement", "", "Button1")

ProcessWait("IEXPLORE.EXE")

For $i = 15 To 1 Step -1

TrayTip('Belarc Advisor', 'Please wait for ' & $i & ' seconds . . .', 0, 1)

Sleep(1000)

TrayTip("clear tip","",0)

Next

TrayTip('Belarc Advisor', 'Gathering Belarc Advisor information . . . please wait . . .', 0, 1)

WinActivate("Belarc Advisor Current Profile", "Belarc Advisor Current Profile")

Sleep(2000)

Send("!f")

Sleep(2000)

Send("a")

WinWait("Save")

Sleep(2000)

WinActivate("Save")

Send(@ComputerName)

Sleep(1000)

Send("{TAB}")

Sleep(1000)

Send("{DOWN}")

Sleep(1000)

Send("{UP}")

Sleep(1000)

Send("{ENTER}")

TrayTip("clear tip","",0)

Sleep(2000)

Send("{ENTER}")

AdlibEnable ("Yes")

Sleep(2000)

For $i = 5 To 1 Step -1

TrayTip('Belarc Advisor', 'Please wait for ' & $i & ' seconds . . .', 0, 1)

Sleep(1000)

TrayTip("clear tip","",0)

Next

AdlibDisable()

TrayTip('Belarc Advisor', 'Performing cleanup . . . please wait . . .', 0, 1)

FileCopy(@MyDocumentsDir & "\*PC*.htm", "S:\Other Stuff\SJSReports\Belarc\", 9)

Sleep(1000)

FileDelete( @DesktopCommonDir & "\Belarc*.lnk")

Sleep(500)

FileDelete( @DesktopDir & "\Belarc*.lnk")

Sleep(500)

FileDelete( @ProgramsCommonDir & "\Belarc*.lnk")

Sleep(500)

FileDelete( @ProgramsDir & "\Belarc*.lnk")

Sleep(500)

FileDelete( @AppDataCommonDir & "\Microsoft\Internet Explorer\Quick Launch\Belarc*.lnk")

Sleep(500)

FileDelete( @AppDataDir & "\Microsoft\Internet Explorer\Quick Launch\Belarc*.lnk")

Sleep(500)

FileCopy( @ScriptDir & "\Belarc Advisor.lnk", @ProgramsCommonDir & "\Accessories\System Tools")

Sleep(500)

TrayTip("clear tip","",0)

ProcessClose("iexplore.exe")

MsgBox(64, "Success!", "Operation completed successfully!", 5)

Func Yes()

If WinExists("Save Webpage") Then

WinActivate("Save Webpage")

Sleep(1500)

Send("{TAB}")

Sleep(1500)

Send("{ENTER}")

Sleep(5000)

EndIf

EndFunc

Each .htm file draws it's name from the computer's unique name and is saved to a network share. An adlib section compensates if the procedure has been run before on the machine. Lots of 'sleep' here to account for slow machines, but it gets the job done.

2) Run the following script to extract relevant data from the .htm files and place same into an Excel spreadsheet:

CODE
#include <IE.au3>

#include <Date.au3>

#include <Array.au3>

#include <File.au3>

#region MS Excel Constants

Const $xlLeft = -4131

Const $xlCenter = -4108

Const $xlRight = -4152

Const $xlTop = -4160

Const $xlBottom = -4107

Const $xlNormal = -4143

Const $xlVAlignBottom = -4107

Const $xlVAlignCenter = -4108

Const $xlVAlignDistributed = -4117

Const $xlVAlignJustify = -4130

Const $xlVAlignTop = -4160

#endregion

TraySetIcon("C:\Program Files\Belarc\Advisor\System\NPBelv32.dll")

TraySetToolTip(' Belarc Report Wizard is active . . . ')

$oExcel = ObjCreate("Excel.Application");Create an Excel File

$oExcel.WorkBooks.Add

;Color the Worksheet with a Background Image

;$oExcel.ActiveWorkBook.Activesheet.SetBackgroundPicture ("S:\Other Stuff\SJSReports\Belarc\Tile1.jpg")

$oExcel.ActiveWorkBook.Activesheet.Range("A1:Z200").Interior.ColorIndex = 56;Color a Cell Range with a Color

$oExcel.ActiveWorkBook.Activesheet.Tab.ColorIndex = 1;format main tab and hide unused tabs

$oExcel.ActiveWorkBook.Activesheet.Name = "Belarc Report"

$oExcel.ActiveWorkBook.Sheets(2).Visible = False

$oExcel.ActiveWorkBook.Sheets(3).Visible = False

$oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 3).Value=("Belarc" & @LF & "Report");Create Date/Time/Title/Notation Area

$oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 2).Value=("" & _NowDate() & "")

$oExcel.ActiveWorkBook.ActiveSheet.Cells(3, 2).Value=("" & _NowTime() & "")

$oExcel.ActiveWorkBook.ActiveSheet.Cells(2, 4).Value="Notes: "()

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 1).Value="#";Populate the Spreadsheet with Header Values

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 2).Value="Name"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 3).Value="Membership"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 4).Value="CPU"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 5).Value="HDD"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 6).Value="-free"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 7).Value="RAM"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 8).Value="Slot1"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 9).Value="Slot2"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 10).Value="BusClock"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 11).Value="Board"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 12).Value="OperatingSys"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 13).Value="FileSys"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 14).Value="#"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 15).Value="#"

$oExcel.ActiveWorkBook.ActiveSheet.Cells(4, 16).Value="Location"

$oExcel.Activesheet.Range($oExcel.Cells(1, 1), $oExcel.Cells(1, 14)).Interior.ColorIndex = 1;Format the Header

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells(2, 1), $oExcel.Cells(3, 1)).Interior.ColorIndex = 1

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells(2, 14), $oExcel.Cells(3, 14)).Interior.ColorIndex = 1

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells(2, 2), $oExcel.Cells(3, 13)).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells(4, 1), $oExcel.Cells(4, 14)).Interior.ColorIndex = 1

$oExcel.Activesheet.Range($oExcel.Cells(2, 3), $oExcel.Cells(2, 3)).Font.Bold = True

$oExcel.Activesheet.Range($oExcel.Cells(3, 2), $oExcel.Cells(3, 2)).Font.Italic = True

$oExcel.Activesheet.Range($oExcel.Cells(2, 2), $oExcel.Cells(2, 2)).Font.Bold = True

$oExcel.Activesheet.Range($oExcel.Cells(4, 1), $oExcel.Cells(4, 14)).Font.Bold = True

$oExcel.Activesheet.Range($oExcel.Cells(4, 16), $oExcel.Cells(4, 16)).Font.Underline = True

$oExcel.Activesheet.Range($oExcel.Cells(2, 3), $oExcel.Cells(2, 3)).Font.Size = 13

$oExcel.Activesheet.Range($oExcel.Cells(2, 2), $oExcel.Cells(2, 2)).Font.Size = 11

$oExcel.Activesheet.Range($oExcel.Cells(3, 2), $oExcel.Cells(3, 2)).Font.Size = 8

$oExcel.Activesheet.Range($oExcel.Cells(2, 2), $oExcel.Cells(3, 3)).HorizontalAlignment = $xlCenter

$oExcel.Activesheet.Range($oExcel.Cells(2, 3), $oExcel.Cells(3, 3)).MergeCells = True

$oExcel.Activesheet.Range($oExcel.Cells(2, 4), $oExcel.Cells(3, 13)).MergeCells = True

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells(2, 4), $oExcel.Cells(3, 13)).WrapText = True

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells(2, 4), $oExcel.Cells(3, 13)).ShrinkToFit = True

$oExcel.Activesheet.Range($oExcel.Cells(2, 3), $oExcel.Cells(2, 3)).VerticalAlignment = $xlVAlignCenter

$oExcel.Activesheet.Range($oExcel.Cells(3, 2), $oExcel.Cells(3, 2)).VerticalAlignment = $xlVAlignTop

$oExcel.Activesheet.Range($oExcel.Cells(2, 4), $oExcel.Cells(2, 13)).VerticalAlignment = $xlVAlignTop

$oExcel.Activesheet.Range($oExcel.Cells(4, 1), $oExcel.Cells(4, 16)).Font.ColorIndex = 2

$oExcel.Activesheet.Rows(2).RowHeight = 36

$oExcel.Activesheet.Rows(3).RowHeight = 36

$oExcel.Activesheet.Rows(4).RowHeight = 18

$oExcel.Activesheet.Range($oExcel.Cells(4, 1), $oExcel.Cells(4, 14)).VerticalAlignment = $xlVAlignCenter

$oExcel.Activesheet.Range($oExcel.Cells(4, 1), $oExcel.Cells(4, 4)).HorizontalAlignment = $xlCenter

$oExcel.Activesheet.Range($oExcel.Cells(4, 5), $oExcel.Cells(4, 5)).HorizontalAlignment = $xlRight

$oExcel.Activesheet.Range($oExcel.Cells(4, 7), $oExcel.Cells(4, 14)).HorizontalAlignment = $xlCenter

$oExcel.Activesheet.Range($oExcel.Cells(4, 14), $oExcel.Cells(4, 14)).Font.ColorIndex = 1

$oExcel.Activesheet.Range($oExcel.Cells(4, 15), $oExcel.Cells(4, 15)).Font.ColorIndex = 56

$oExcel.Activesheet.Columns(1).Autofit

$oExcel.Activesheet.Columns(2).Autofit

$oExcel.Activesheet.Columns(3).Autofit

$oExcel.Activesheet.Columns(4).Autofit

$oExcel.Activesheet.Columns(5).Autofit

$oExcel.Activesheet.Columns(6).Autofit

$oExcel.Activesheet.Columns(7).Autofit

$oExcel.Activesheet.Columns(8).Autofit

$oExcel.Activesheet.Columns(9).Autofit

$oExcel.Activesheet.Columns(10).Autofit

$oExcel.Activesheet.Columns(11).Autofit

$oExcel.Activesheet.Columns(12).Autofit

$oExcel.Activesheet.Columns(13).Autofit

$oExcel.Activesheet.Columns(14).Autofit

$oExcel.Activesheet.Columns(15).Autofit

$oExcel.Activesheet.Columns(16).Autofit

$oExcel.Visible = 1; make the workbook visible

If MsgBox(33, "Belarc Report", "Ready to begin?") == 2 Then Exit

Dim $count = 4

$tmplst = "S:\Other Stuff\SJSReports\Belarc\";Search for all Belarc files in the Mapped Network Share

$search = FileFindFirstFile($tmplst&"*PC*.htm")

While 1;Search for the Relevant Data

$file = FileFindNextFile($search)

If @error Then ExitLoop

$site = $file

$browser=_IECreate($tmplst&$site, 0, 0);3rd param - hidden(0)/visible(1)

$sText = _IEBodyReadText ($browser)

ProcessWait("iexplore.exe")

$OF = FileOpen($tmplst&"list.txt",2)

FileWrite($OF,$sText)

FileClose($OF)

$handle = FileOpen($tmplst&"list.txt",0);Computer Name for TrayTip

While 1

Dim $Split_

$line_ = FileReadLine($handle)

If StringinStr($line_, "Computer Name") Then

$trim_a = StringTrimLeft($line_, 15)

$trim_b = StringUpper($trim_a)

$Split_ = StringSplit($trim_b, " ")

$FileName = $Split_[1]

TrayTip("Belarc Report", "Reading data for " & $FileName & " . . . please wait . . .", 15, 17)

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Computer Name

While 1

$line0 = FileReadLine($handle)

If StringinStr($line0, "Computer Name") Then

$trim0a = StringTrimLeft($line0, 15)

$upper0 = StringUpper($trim0a)

$Split0 = StringSplit($upper0, " ")

$result0 = $Split0[1]

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Computer Membership

While 1

$line1 = FileReadLine($handle)

If StringinStr($line1, "Computer Name") Then

$trim1a = StringTrimLeft($line1, 15)

$trim1b = StringTrimRight($trim1a, 1)

$upper1 = StringUpper($trim1b)

$Split1 = StringSplit($upper1, " ")

_ArrayReverse($Split1)

$trim1c = _ArraytoString($Split1[0], " ", 1)

$trim1d = $Split1[0]

If StringIsAlpha($trim1d) Then

$result1 = $trim1d

Else

$result1 = "~~ no data ~~"

EndIf

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Central Processing Unit

While 1

Dim $Split2

$line2 = FileReadLine($handle)

If StringinStr($line2, "hertz Intel ") Then

$trim2a = StringReplace($line2, " gigahertz", "GHz")

$trim2b = StringReplace($trim2a, " megahertz", "MHz")

$trim2c = StringReplace($trim2b, "Intel Pentium ", "P")

$trim2d = StringReplace($trim2c, "Intel Celeron", "Cel")

$trim2e = StringReplace($trim2d, "(2 installed)", "(2)")

$Split2 = StringSplit($trim2e, " ")

_ArraySwap( $Split2[1], $Split2[2] )

$trim2f = _ArraytoString($Split2, " ", 1)

$trim2g = StringReplace($trim2f, "1000MHz", "1.0GHz")

$result2 = $trim2g

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);HDD Total Size

While 1

$line3 = FileReadLine($handle)

If StringinStr($line3, "Usable Hard Drive") Then

$trim3a = StringReplace($line3, " Gigabytes", "GB")

$trim3b = StringReplace($trim3a, " Megabytes", "MB")

$result3 = StringReplace($trim3b, " Usable Hard Drive Capacity", "")

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);HDD Free Space

While 1

$line4 = FileReadLine($handle)

If StringinStr($line4, "Hard Drive Free") Then

$trim4a = StringReplace($line4, " Gigabytes", "GB")

$trim4b = StringReplace($trim4a, " Megabytes", "MB")

$result4 = StringReplace($trim4b, " Hard Drive Free Space", "")

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Installed RAM

While 1

Dim $Split5

$line5 = FileReadLine($handle)

If StringinStr($line5, "Installed Memory") Then

$trim5a = StringReplace($line5, " Megabytes", "MB")

$trim5b = StringReplace($trim5a, " Installed Memory", "")

$Split5 = StringSplit($trim5b, " ", 1)

_ArrayReverse( $Split5)

$result5 = $Split5[0]

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);DIMM Slot 1 Usage

While 1

Dim $Split6a

Dim $Split6b

$line6 = FileReadLine($handle)

If StringinStr($line6, "Slot", 0, 1) Then

$Split6a = StringSplit($line6, " MB", 1)

If @error Then

$result6 = "Empty"

ExitLoop

EndIf

_ArraySwap( $Split6a[1], $Split6a[2] )

_ArrayAdd( $Split6a, "MB")

$trim6a = _ArraytoString($Split6a, " ", 1)

$trim6b = StringReplace($trim6a, " MB", "MB")

$Split6b = StringSplit($trim6b, " ", 1)

_ArrayReverse( $Split6b)

$result6 = $Split6b[0]

ExitLoop

EndIf

Wend

FileClose($handle)

Dim $Split7a;DIMM Slot 2 Usage

Dim $Split7b

$handle = FileOpen($tmplst&"list.txt",0)

$num = _FileCountLines($tmplst&"list.txt")

$find = "Slot"

For $x = $num to 1 Step - 1

$line = FileReadLine($handle, $x)

If StringInStr($line, $find) Then

$y = $x + 1

EndIf

Next

While 1

$line7 = FileReadLine($handle, $y)

If StringinStr($line7, "Slot", 0, 1) Then

$Split7a = StringSplit($line7, " MB", 1)

If @error Then

$result7 = "Empty"

ExitLoop

EndIf

_ArraySwap( $Split7a[1], $Split7a[2] )

_ArrayAdd( $Split7a, "MB")

$trim7b = _ArraytoString($Split7a, " ", 1)

$trim7c = StringReplace($trim7b, " MB", "MB")

$Split7b = StringSplit($trim7c, " ", 1)

_ArrayReverse( $Split7b)

$result7 = $Split7b[0]

ExitLoop

EndIf

WEnd

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Bus Clock

While 1

$line8 = FileReadLine($handle)

If StringinStr($line8, "Bus Clock:") Then

$trim8a = StringReplace($line8, "Bus Clock: ", "")

$trim8b = StringReplace($trim8a, " megahertz", "MHz")

$result8 = $trim8b

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Motherboard

While 1

Dim $Split9a

Dim $Split9b

$line9 = FileReadLine($handle)

If StringinStr($line9, "secondary memory cache", 0, 1) Then

$Split9a = StringSplit($line9, " cache", 1)

_ArraySwap( $Split9a[1], $Split9a[2] )

$trim9a = _ArraytoString($Split9a, " ", 1)

$trim9b = StringReplace($trim9a, "Board: ", "")

$Split9b = StringSplit($trim9b, " ", 1)

$result9 = $Split9b[2]

ExitLoop

EndIf

WEnd

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Operating System

While 1

$line10 = FileReadLine($handle)

If StringinStr($line10, "Windows XP") Then

$trim10a = StringReplace($line10, "Windows", "Win")

$trim10b = StringReplace($trim10a, "Service Pack 2", "SP2")

$trim10c = StringReplace($trim10b, "Professional", "Pro")

$result10 = StringLeft($trim10c, StringInStr($trim10c, 'SP2') + 2)

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);File System

While 1

Dim $Split11

$line11 = FileReadLine($handle)

If StringinStr($line11, "c:") Then

$trim11a = StringTrimLeft($line11, 4)

$Split11 = StringSplit($trim11a, " ", 1)

$result11 = StringTrimRight($Split11[1], 0)

ExitLoop

EndIf

Wend

FileClose($handle)

$handle = FileOpen($tmplst&"list.txt",0);Location

While 1

Dim $Split12, $result12

$line12 = FileReadLine($handle)

If StringinStr($line12, "Computer Name") Then

$trim12a = StringTrimLeft($line12, 15)

$upper12 = StringUpper($trim12a)

$Split12 = StringSplit($upper12, " ")

$result12a = StringTrimRight($Split12[1], 6)

;_ArrayDisplay($Split12, "Testing...")

Select

Case $result12a = "108"

$result12 = "Computer Lab"

Case $result12a = "205"

$result12 = "Kindergarten"

Case $result12a = "204"

$result12 = "Kindergarten"

Case $result12a = "206"

$result12 = "Grade1"

Case $result12a = "207"

$result12 = "Grade1"

Case $result12a = "201"

$result12 = "Grade2"

Case $result12a = "202"

$result12 = "Grade2"

Case $result12a = "104"

$result12 = "Grade3"

Case $result12a = "105"

$result12 = "Grade3"

Case $result12a = "102"

$result12 = "Grade4"

Case $result12a = "103"

$result12 = "Grade4"

Case $result12a = "307"

$result12 = "Grade5"

Case $result12a = "308"

$result12 = "Grade5"

; Case $result12a = "208"

; $result12 = "Resource"

Case $result12a = "304"

$result12 = "Mathematics"

Case $result12a = "306"

$result12 = "Science"

Case $result12a = "310"

$result12 = "Library"

Case $result12a = "312"

$result12 = "Resource"

Case $result12a = "302"

$result12 = "Religion"

Case $result12a = "301"

$result12 = "Social Studies"

Case $result12a = "303"

$result12 = "Literature"

Case $result12a = "COUNSE"

$result12 = "Mrs. T.G."

Case $result12a = "305"

$result12 = "Language"

; Case $result12a = ""

; $result12 = ""

Case Else

$result12 = "?"

EndSelect

ExitLoop

EndIf

Wend

FileClose($handle)

Dim $Row = _Count()

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 1).Interior.ColorIndex = 1;Format the Row

;$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 1).HorizontalAlignment = $xlCenter

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 1).Font.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 1).Font.Bold = True

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 2).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 3).Interior.ColorIndex = 15

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 4).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 5).Interior.ColorIndex = 15

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 6).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 7).Interior.ColorIndex = 15

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 8).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 9).Interior.ColorIndex = 15

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 10).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 11).Interior.ColorIndex = 15

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 12).Interior.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 13).Interior.ColorIndex = 15

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 14).Interior.ColorIndex = 1

$oExcel.ActiveWorkBook.Activesheet.Cells($Row, 16).Font.ColorIndex = 2

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 1).Value=$Row-4;Write Information to the Row

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 2).Value=$result0

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 3).Value=$result1

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 4).Value=$result2

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 5).Value=$result3

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 6).Value=$result4

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 7).Value=$result5

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 8).Value=$result6

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 9).Value=$result7

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 10).Value=$result8

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 11).Value=$result9

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 12).Value=$result10

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 13).Value=$result11

$oExcel.ActiveWorkBook.ActiveSheet.Cells($Row, 16).Value=$result12

$oExcel.Activesheet.Columns(1).Autofit

$oExcel.Activesheet.Columns(2).Autofit

$oExcel.Activesheet.Columns(3).Autofit

$oExcel.Activesheet.Columns(4).Autofit

$oExcel.Activesheet.Columns(5).Autofit

$oExcel.Activesheet.Columns(6).Autofit

$oExcel.Activesheet.Columns(7).Autofit

$oExcel.Activesheet.Columns(8).Autofit

$oExcel.Activesheet.Columns(9).Autofit

$oExcel.Activesheet.Columns(10).Autofit

$oExcel.Activesheet.Columns(11).Autofit

$oExcel.Activesheet.Columns(12).Autofit

$oExcel.Activesheet.Columns(13).Autofit

$oExcel.Activesheet.Columns(14).Autofit

$oExcel.Activesheet.Columns(15).Autofit

$oExcel.Activesheet.Columns(16).Autofit

ProcessClose("iexplore.exe")

Sleep(40)

WEnd

FileClose($search); Close the search handle

TrayTip("clear tray tip","",0)

$LastRow = _Count(); Arrive at Conclusion

$oExcel.ActiveWorkBook.Activesheet.Range($oExcel.Cells($LastRow, 1), $oExcel.Cells($LastRow, 14)).MergeCells = True

$oExcel.ActiveWorkBook.Activesheet.Cells($LastRow, 1).Interior.ColorIndex = 1

$oExcel.ActiveWorkBook.Activesheet.Cells($LastRow, 1).HorizontalAlignment = $xlCenter

$oExcel.ActiveWorkBook.Activesheet.Cells($LastRow, 1).Font.ColorIndex = 2

$oExcel.ActiveWorkBook.Activesheet.Cells($LastRow, 1).Font.Bold = True

$oExcel.ActiveWorkBook.Activesheet.Cells($LastRow, 1).Value = "'~~~~~ End of Belarc Report ~~~~~"

MsgBox(4096, "Belarc Report", "The report is ready for your review!", 5)

Exit

Func _Count()

$count = $count + 1

Return $count

EndFunc

Lots of string trimming and virtually NO error checking, but I'm pretty familiar with the state of these machines. It's an ongoing project and occupies my time when I have the time. :P

Edited for updates to the scripts, including Excel spreadsheet format.

Edited by blinkdt

"No peace for the wicked, no rest for the good."

Share this post


Link to post
Share on other sites

Was anyone successful in using blinkdt's script to parse Belarc logs?

Share this post


Link to post
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
Sign in to follow this  
Followers 0