lundi 28 mai 2018

I want to get specific string from a text file

Following is the log from which i just wanted to get the string at its end which is "Total conversion time (11766 element(s))|36565 millisecs" and it's number will be change in the new run . like may be second time if i run the software i get "Total conversion time (12366 element(s))|36465 millisecs"

++ LOG> INFO DgnV8Converter.Performance - Convert Spatial Elements> Model 'Office Building' (2 element(s))|64 millisecs [ ] Converting Elements: Model: Architecture :6/3 +++ LOG> INFO DgnV8Converter.Performance - Convert Spatial Elements> Model 'Architecture' (8257 element(s))|5640 millisecs [ ] Converting Elements: Model: Civil :6/2 +++ LOG> INFO DgnV8Converter.Performance - Convert Spatial Elements> Model 'Civil' (164 element(s))|183 millisecs [ ] Converting Elements: Model: MEP :6/1 +++ LOG> INFO DgnV8Converter.Performance - Convert Spatial Elements> Model 'MEP' (2916 element(s))|3593 millisecs [ ] Converting Elements: Model: Structural :6/0 +++ LOG> INFO DgnV8Converter.Performance - Convert Spatial Elements> Model 'Structural' (427 element(s))|493 millisecs +++ LOG> INFO DgnV8Converter.Performance - Convert Spatial Elements (total)|10047 millisecs [ ] Converting Drawings: :5/0 +++ LOG> INFO DgnV8Converter.Performance - Convert Drawings (total)|3 millisecs [ ] Converting Sheets: :4/0 +++ LOG> INFO DgnV8Converter.Performance - Convert Sheets (total)|3 millisecs [ ] Converting Sheets: Model: Office Building :4/4 +++ LOG> INFO DgnV8Converter.Performance - Convert NamedGroups in dictionary (0 element(s))|4 millisecs [ ] Converting Sheets: Converting Relationships :4/0 +++ LOG> INFO DgnV8Converter.Performance - Convert Elements> ECRelationships: Dropped indices for bulk insertion into BisCore:ElementRefersToElements class hierarchy.|1 millisecs +++ LOG> INFO DgnV8Converter.Performance - Convert Elements> NamedGroups|247 millisecs +++ LOG> INFO DgnV8Converter.Performance - Convert Elements> ECRelationships (total)|2 millisecs +++ LOG> INFO DgnV8Converter.Performance - Convert Elements> ECRelationships: Recreated indices for BisCore:ElementRefersToElements class hierarchy.|11 millisecs [ ] Embedding Files: :3/0 [ ] Embedding Fonts: :2/0 [ ] Creating Thumbnails: :1/0 [ ] Creating Thumbnails: View: Model - View 1 :1/8 [ ] Creating Thumbnails: View: Kitchen :1/7 [ ] Creating Thumbnails: View: First Floor Office Space :1/6 [ ] Creating Thumbnails: View: Second Floor Open Space :1/5 [ ] Creating Thumbnails: View: Third Floor Unfinished Space :1/4 [ ] Creating Thumbnails: View: Aerial North Face :1/3 [ ] Creating Thumbnails: View: Aerial West Face :1/2 [ ] Creating Thumbnails: View: Aerial South Face :1/1 [ ] Creating Thumbnails: View: Front Entrance :1/0 +++ LOG> INFO DgnV8Converter.Performance - Finish conversion|26396 millisecs +++ LOG> INFO DgnV8Converter.Performance - Total conversion time (11766 element(s))|36565 millisecs

function ReadFileLines()
{
 var str,AFileName="D:\\ConverterElements\\bingo.log";
  var F, s;
  var s = aqFile.ReadWholeTextFile(AFileName, aqFile.ctANSI);
  Log.Message("File entire contents:");
  Log.Message(s);
    let aSubString="11766 element" 
    let Res = aqString.Find(s, aSubString)
    if ( Res != -1) 
    Log.Checkpoint("Element Count is same");
  else
    Log.Error("Element Count is Different");    
 }

strong text

Aucun commentaire:

Enregistrer un commentaire