|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VB Solution???
to all VB programmers:-
Would appreciate whatever assistance to code in VB to the following requirements. 1. Read through the master file and locate for line that contains V4_PL1. 2. Once line is located, open and print to another output file the line that start's with V4_PL1 and all the contents below it till it reaches line that contains "Manual" character. 3. Then output file that contains line from V4_PL1 to Manual (inclusive) is closed and created in a directory. (eg. PL1.scr) 4. Close master file. 5. Open master file again to locate and read subsequent line that contains V5_PL2 till the next line that contains "MANUAL" character. 6. Create a new output file( eg. PL2.scr) and put the contents capture in No. 5 into it and file is closed. 7. This output file creation for each Pull line station (PL) is repeated till end of master file. (eg. PL3, PL4....) · the challenge here that the number of Pull line stations vary depends on the master file. Usually it is not more than 10 Pull Line stations but not necessary 10. Can be 6, 7 or 8 PL stations. Can the allocation of output files be set first in the code or it can dynamically grow depend on the number of output file? Below is the sample master input file and output file. extract from master file ZOOM ALL LAYER MAKE BORDER LAYER SET BORDER COLOR WHITE LAYER MAKE V4_PL1 LAYER MAKE V4_PL1_Silk LAYER SET V4_PL1 COLOR WHITE LAYER OFF BORDER LAYER SET V4_PL1 LAYER MAKE V4_PL1 LAYER MAKE V4_PL1_Silk LAYER SET V4_PL1 COLOR BLUE ; C3C3 CIRCLE 7.00687,7.70815 0.07668 COLOR WHITE TEXT J C 6.625,0.075 0.100 0 Manual Pull Line Station 1 TEXT J C 15.375,0.075 0.100 0 V4 output file LAYER MAKE V4_PL1 LAYER MAKE V4_PL1_Silk LAYER SET V4_PL1 COLOR WHITE LAYER OFF BORDER LAYER SET V4_PL1 LAYER MAKE V4_PL1 LAYER MAKE V4_PL1_Silk LAYER SET V4_PL1 COLOR BLUE ; C3C3 CIRCLE 7.00687,7.70815 0.07668 ; C3C6 COLOR WHITE TEXT J C 6.625,0.075 0.100 0 Manual Pull Line Station 1 i've coded a little but enable to completd it. please HELP! Dim SCRFile As String Private Sub cmdOpen_Click() ' open dialog box only display .scr files Dlg.Filter = "SCR file|*.scr|All files|*.*" Dlg.ShowOpen If Dlg.FileName <> "" Then ' text file text property to hold value of dialog box file name txtSCR.Text = Dlg.FileName ' SCR file variable to hold value of output1 file dialog box file name SCRFile = Dlg.FileName End If End Sub Private Sub Command1_Click() Dim SCRLineData As String Dim PLLineData As String Dim PLFile As String Dim PLFN As Integer Dim SCRFN As Integer Dim fields Dim line_num() As Integer Dim field_num As Integer Dim lines() Dim i As Integer Dim phase As Integer phase = CInt(Manual) PLFile = txtPL.Text PLFN = FreeFile Open PLFile For Output As #PLFN SCRFN = FreeFile Open SCRFile For Input As #SCRFN fields = Split(SCRLineData, " ") Do While Not EOF(SCRFN) Line Input #SCRFN, SCRLineData If InStr(1, SCRLineData, "Manual") Then EOF (SCRFN) Exit Sub Else If InStr(1, SCRLineData, "V4_PL1") Then For i = 0 To ??? 'lines = Split(Contents, vbCrLf) Line Input #SCRFN, SCRLineData Print #PLFN, SCRLineData 'Loop Next i End If End If Loop Close #PLFN Close #SCRFN Close frmSCR_test End Sub ThTHanks and really appreciated feedback |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > VB Solution??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|