mdwerne Posted August 11, 2008 Share Posted August 11, 2008 Hello, I am trying to display the date and revision of Norton Antivirus Definitions: The file with the info is here: "C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat" and contains these three lines only: [DefDates] CurDefs=20080811.016 LastDefs=20080810.022 So...what I have so far (which stinks) is this: Dim $aRecords If Not _FileReadToArray("C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat", $aRecords) Then MsgBox(4096, "Error", " Error determining date of AntiVirus Definitions" & @error) Exit EndIf For $x = 1 To $aRecords[0] Next $CurDefs = $aRecords[2] Needless to say when I display it it's just plain ugly. $AVDefs = GUICtrlCreateInput($CurDefs, 25, 100, 450, 30) Can anyone suggest how I might better grab the data and format it more logically? Current Definition File: 08/11/2008 Revision: 016 I tried playing with StringRegExp but could not get the pattern matching correct. Thanks for any suggestions. -Mike Link to comment Share on other sites More sharing options...
Developers Jos Posted August 11, 2008 Developers Share Posted August 11, 2008 Just use the IniRead() function which should work fine too. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Andreik Posted August 11, 2008 Share Posted August 11, 2008 #include <File.au3> $PATH = "C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat" $FILE = FileOpen($PATH,0) $DATA = "" For $INDEX = 1 To _FileCountLines($PATH) $DATA &= FileReadLine($FILE,$INDEX) & @CRLF Next MsgBox(0,"DEF INFO",$DATA) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
mdwerne Posted August 11, 2008 Author Share Posted August 11, 2008 Just use the IniRead() function which should work fine too. Yep, that worked GREAT!! $var = IniRead("C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat", "DefDates", "CurDefs", "NotFound") MsgBox(4096, "Result", $var) Can you now point me toward how I might rearrange the result from: "20080811.016" to "08/11/2008 Rev. 016"? Thanks Jos, this is one way cool tool! -Mike Link to comment Share on other sites More sharing options...
Andreik Posted August 11, 2008 Share Posted August 11, 2008 Yep, that worked GREAT!! $var = IniRead("C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat", "DefDates", "CurDefs", "NotFound") MsgBox(4096, "Result", $var) Can you now point me toward how I might rearrange the result from: "20080811.016" to "08/11/2008 Rev. 016"? Thanks Jos, this is one way cool tool! -Mike $TIME = "20080811.016" $REV = StringSplit($TIME,".") $NEW = StringMid($TIME,5,2) & "/" & StringMid($TIME,7,2) & "/" & StringLeft($TIME,4) & " Rev. " & $REV[2] MsgBox(0,"",$NEW) When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Achilles Posted August 11, 2008 Share Posted August 11, 2008 Along with what Andreik said you'll want to use IniWrite() My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
mdwerne Posted August 12, 2008 Author Share Posted August 12, 2008 $TIME = "20080811.016" $REV = StringSplit($TIME,".") $NEW = StringMid($TIME,5,2) & "/" & StringMid($TIME,7,2) & "/" & StringLeft($TIME,4) & " Rev. " & $REV[2] MsgBox(0,"",$NEW)Shazam! Exactly what the Dr. ordered! Thanks Andreik for your great suggestion. Putting the suggestions together, I now have this. $RAWDEFS = IniRead("C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat", "DefDates", "CurDefs", "NotFound") $REV = StringSplit($RAWDEFS,".") $DEFS = StringMid($RAWDEFS,5,2) & "/" & StringMid($RAWDEFS,7,2) & "/" & StringLeft($RAWDEFS,4) & " Rev. " & $REV[2] MsgBox(0,"",$DEFS) Mucho apreciado! -Mike Link to comment Share on other sites More sharing options...
weaponx Posted August 12, 2008 Share Posted August 12, 2008 Yep, that worked GREAT!! $var = IniRead("C:\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat", "DefDates", "CurDefs", "NotFound") MsgBox(4096, "Result", $var) Can you now point me toward how I might rearrange the result from: "20080811.016" to "08/11/2008 Rev. 016"? Thanks Jos, this is one way cool tool! -Mike ;Convert YYYYMMDD.RRR to MM/DD/YYYY Rev. RRR $original = "20080811.016" $new = StringRegExpReplace($original, "\A(\d{4})(\d{2})(\d{2})\.(\d{3})","$2/$3/$1 Rev. $4") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now