GingerStepChild
New Member
- Joined
- Oct 27, 2016
- Messages
- 28
Hi,
I hope I can explain this properly.
I have a text file which I can open and read in VB.
I can search for a string ("FindECM" which is 193-ECM-ETR/A) that I need but then I am required to go back a few lines and then read another string ("ModuleName" which is everything between first 2 spaces after MODULE) that is in the exact same place relative to the FindECM every time. Unfortunately thye Module can be of many different types so I need to find the correct type first.
ModuleName would be put into Column A of an excel sheet
ModuleDescription would be in Column B. This is everything between the quotes on the same line as MODULE (Aspirator (30.3) - DOL$N).
MajorRev in Column C (integer)
MinorRev in Column D (integer)
NodeAddress in Column E (String)
Finally, I want to get some data from ConfigData...
Data1 is the number after the fifth comma (50) after the opening square bracket. Column F
Data2 is the number after the sixth comma (50). Column G
Data3 is the number after the ninth comma (75). Column H
Data4 is the number after the tenth comma (85). Column I
After this I want to find next instance of the string.
Sample text
Most of my short VB history has been writing text files from Excel sheets and so any help about how to read back a few lines and then extract text to Rows and columns would be very much appreciated.
Thanks in advance
Graham
I hope I can explain this properly.
I have a text file which I can open and read in VB.
I can search for a string ("FindECM" which is 193-ECM-ETR/A) that I need but then I am required to go back a few lines and then read another string ("ModuleName" which is everything between first 2 spaces after MODULE) that is in the exact same place relative to the FindECM every time. Unfortunately thye Module can be of many different types so I need to find the correct type first.
ModuleName would be put into Column A of an excel sheet
ModuleDescription would be in Column B. This is everything between the quotes on the same line as MODULE (Aspirator (30.3) - DOL$N).
MajorRev in Column C (integer)
MinorRev in Column D (integer)
NodeAddress in Column E (String)
Finally, I want to get some data from ConfigData...
Data1 is the number after the fifth comma (50) after the opening square bracket. Column F
Data2 is the number after the sixth comma (50). Column G
Data3 is the number after the ninth comma (75). Column H
Data4 is the number after the tenth comma (85). Column I
After this I want to find next instance of the string.
Sample text
MODULE E30_3_36M501_Level_5_S3B (Description := "Aspirator (30.3) - DOL$N",
Parent := "Network_S3B",
ParentModPortId := 2,
CatalogNumber := "193-ECM-ETR/A",
Vendor := 1,
ProductType := 3,
ProductCode := 651,
Major := 4,
Minor := 83,
PortLabel := "ENet",
NodeAddress := "192.168.40.46",
Mode := 2#0000_0000_0000_0000,
CompatibleModule := 1,
KeyMask := 2#0000_0000_0001_1111)
ExtendedProp := [[[___
<controlmoduletype>1</controlmoduletype><controlmodulemismatchtripen>2</controlmodulemismatchtripen><sensingmoduletype>5</sensingmoduletype><sensingmodulemismatchtripen>2</sensingmodulemismatchtripen><digital1type>0</digital1type><digital1mismatchtripen>2</digital1mismatchtripen><digital2type>0</digital2type><digital2mismatchtripen>2</digital2mismatchtripen><digital3type>0</digital3type><digital3mismatchtripen>2</digital3mismatchtripen><digital4type>0</digital4type><digital4mismatchtripen>2</digital4mismatchtripen><analog1type>0</analog1type><analog1mismatchtripen>2</analog1mismatchtripen><analog2type>0</analog2type><analog2mismatchtripen>2</analog2mismatchtripen><analog3type>0</analog3type><analog3mismatchtripen>2</analog3mismatchtripen><analog4type>0</analog4type><analog4mismatchtripen>2</analog4mismatchtripen><operatorstationtype>0</operatorstationtype><operatorstationmismatchtripen>2</operatorstationmismatchtripen><userdefineddata0>2</userdefineddata0><userdefineddata1>3</userdefineddata1><userdefineddata2>28</userdefineddata2><userdefineddata3>29</userdefineddata3><userdefineddata4>30</userdefineddata4><userdefineddata5>31</userdefineddata5><userdefineddata6>38</userdefineddata6><userdefineddata7>39</userdefineddata7><operatingmode>2</operatingmode>
2
0
0<configid>300</configid><operatingmodechanged>1</operatingmodechanged>___]]]
ConfigData (Class := Standard) := [412,120,0,2,2,50,50,10,18,75,85,[3,0,0,0,0,0,8649,256,0,0],[-1,-1,63,63,4095,4095,26623,8191,4095,4095],4095,1,5,0,32,0,0,2
,0,600,0,0,500,10000,100,1,10,5,0,250,200,0,10,10,0,600,10,50,250,150,10,50,50,70,10,50,35,20,5,5,10,10,35,40,10,35,40,10
,35,40,10,10,100,90,10,100,90,10,100,90,10,10,10,10,[2,3,28,29,30,31,38,39],0,0,-1,480,480,0,10,10,10,1000,4000,10,10,5000
,4900,10,10,15,10,10,10,57,58,10,10,63,62,15,1,10,10,10,10,0,0,0,0,10,10,10,10,0,0,0,0,10,10,10,10,0,0,0,0,10,10,10,10,0,0,0,0,10
,10,-90,-95,10,10,-95,-90,10,10,90,95,10,10,95,90,1,50,2,3,51,52,38,39,300,0,[10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0],[10,10,10,0,0,0,0,0
,0,0,0,0,0,0,0,0],[10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0],[10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0]];
CONNECTION Standard (Rate := 100000,
EventID := 0,
Unicast := Yes)
InputData (Class := Standard) := [0,18432,9,6,0,0,0,[0,0,0,0,0,0,0,0,0,0,0,0],0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,[9999,0,0,2,2,0,0,0],0,0,[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]];
InputForceData := [0,0,0,0,0,72,9,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,15,39,0,0,0,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
OutputData (Class := Standard) := [0,0,0,0];
OutputForceData := [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
END_CONNECTION
END_MODULE
Most of my short VB history has been writing text files from Excel sheets and so any help about how to read back a few lines and then extract text to Rows and columns would be very much appreciated.
Thanks in advance
Graham