I have a txt file as shown below which is automatically created via AutoCAD. What I want to do is then extract certain information from the txt into my access table.
This is a sample of the txt file :-
# This file was automatically generated by ARX Module
# written at: 16 December 2003 17:30:03
# sActualName = C:\SFLY_S-_SK05_SP---.dwg
DATA_FORMAT 1.0
GENERATORARX
START GENERAL
# Basic info about drawing
BASENAME SFLY_S-_SK05_SP---.dwg
DWGDIR \\LOCAL:C:TBHANDLE 2B9
DWGTITLE1 General Arrangement Showing
DWGTITLE2 Indicative Structure for
DWGTITLE3 Travelator Bridges
DWGTITLE4
JOBTITLE1 on a Flyer
JOBTITLE2
JOBTITLE3
JOBTITLE4
DWGSTATUS Concept
JOBNUMBER 150042
JOBSUFFIX
TBSCALE 1:200
ORIGINATOR
ISSUEDATE
REVISION 1
DWGNUMBER S/SK05
DESCRIPTION
END GENERAL
The portion I need to extract are the attributes i.e
the scale = 1:200.
I have tried something using the mid function but it does not work as it only seems to read one line. Is it possible to specifically retreive information from any given line.??
The format of the txt file will never change.
Here was my attempt. Any help modifying this would be great.
Private Sub Command56_Click()
If IsNull([Path]) Then
MsgBox "You must set Drawing Directory in Path First and give filename for new record"
DoCmd.GoToControl "Path"
End If
Dim stfilename
Dim stPath
Dim temp$
Dim lookfor()
stfilename = ([CADFilename]) + "-dwg.din"
stPath = ([Path]) + "docinfo\"
Open stPath + stfilename For Input As #1
While Not EOF(1)
Line Input #1, temp$
Number1 = (Mid(temp$, 13, 28))
Number2 = (Mid(temp$, 51, 28))
Number3 = (Mid(temp$, 12, 10))
Number4 = (Mid(temp$, 12, 10))
Number5 = (Mid(temp$, 12, 4))
Number6 = (Mid(temp$, 12, 2))
Number7 = (Mid(temp$, 12, 10))
Wend
Me.DrawingTitle1 = Number1
Me.DrawingTitle2 = Number2
Me.DrawingTitle3 = Number3
Me.Status = Number4
Me.DScale = Number5
Me.Revision = Number6
Me.DrawingNumber = Number7
Close #1
End Sub
This theory works in that it will return a null to all the fields in my table. I just need it to pick out the correct text.
This is a sample of the txt file :-
# This file was automatically generated by ARX Module
# written at: 16 December 2003 17:30:03
# sActualName = C:\SFLY_S-_SK05_SP---.dwg
DATA_FORMAT 1.0
GENERATORARX
START GENERAL
# Basic info about drawing
BASENAME SFLY_S-_SK05_SP---.dwg
DWGDIR \\LOCAL:C:TBHANDLE 2B9
DWGTITLE1 General Arrangement Showing
DWGTITLE2 Indicative Structure for
DWGTITLE3 Travelator Bridges
DWGTITLE4
JOBTITLE1 on a Flyer
JOBTITLE2
JOBTITLE3
JOBTITLE4
DWGSTATUS Concept
JOBNUMBER 150042
JOBSUFFIX
TBSCALE 1:200
ORIGINATOR
ISSUEDATE
REVISION 1
DWGNUMBER S/SK05
DESCRIPTION
END GENERAL
The portion I need to extract are the attributes i.e
the scale = 1:200.
I have tried something using the mid function but it does not work as it only seems to read one line. Is it possible to specifically retreive information from any given line.??
The format of the txt file will never change.
Here was my attempt. Any help modifying this would be great.
Private Sub Command56_Click()
If IsNull([Path]) Then
MsgBox "You must set Drawing Directory in Path First and give filename for new record"
DoCmd.GoToControl "Path"
End If
Dim stfilename
Dim stPath
Dim temp$
Dim lookfor()
stfilename = ([CADFilename]) + "-dwg.din"
stPath = ([Path]) + "docinfo\"
Open stPath + stfilename For Input As #1
While Not EOF(1)
Line Input #1, temp$
Number1 = (Mid(temp$, 13, 28))
Number2 = (Mid(temp$, 51, 28))
Number3 = (Mid(temp$, 12, 10))
Number4 = (Mid(temp$, 12, 10))
Number5 = (Mid(temp$, 12, 4))
Number6 = (Mid(temp$, 12, 2))
Number7 = (Mid(temp$, 12, 10))
Wend
Me.DrawingTitle1 = Number1
Me.DrawingTitle2 = Number2
Me.DrawingTitle3 = Number3
Me.Status = Number4
Me.DScale = Number5
Me.Revision = Number6
Me.DrawingNumber = Number7
Close #1
End Sub
This theory works in that it will return a null to all the fields in my table. I just need it to pick out the correct text.