Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

change the specific line

hi by using VB how to read the specific line and change the line in the tex file.
i has 92 line and i only want to change the line 64
here the line
Rep.SetProperty "Dates","1/8/2006-1/10/2006"

i just want to capture the daily date into txt file

plz help me it is urgent :confused:
[315 byte] By [vino] at [2007-11-11 8:10:21]
# 1 Re: change the specific line
If the lines are of equal length you can open a file for Random with LEN=nnn, and then specifically reference any record.

However, if they are not the same length, you will need to open one file for input and one for output, use the LINE INPUT # and PRINT # methods to read & write 63 (in your case) lines, do what you like with line 64, then loop through reading 65+ and writing same.
gupex at 2007-11-11 17:25:52 >
# 2 Re: change the specific line
If the lines are of equal length you can open a file for Random with LEN=nnn, and then specifically reference any record.

However, if they are not the same length, you will need to open one file for input and one for output, use the LINE INPUT # and PRINT # methods to read & write 63 (in your case) lines, do what you like with line 64, then loop through reading 65+ and writing same.

can i have the sample code to do this program.plz help me it is urgent.
still new to vb
vino at 2007-11-11 17:26:49 >
# 3 Re: change the specific line
As suggested in my earlier post, there are 2 different methods depending on the structure of the file you are trying to change. If you can idicate which type you are using (fixed length records, or variable length, then I can provide a little more info.

In either case, if you type each of the words 'Random' and 'Input' and press F1 for Help, you will receive more info. If you do this and still have a problem, then let us know what problem you are still having.
gupex at 2007-11-11 17:27:58 >
# 4 Re: change the specific line
hi here the file content(all together 92 line)

'LANGUAGE=ENU
'SERVERNAME=172.30.253.18
Public Sub Main()

'## cvs_cmd_begin
'## ID = 2001
'## Description = "Report: Historical: Designer: GAR TAC MC Table Sept 2001: Export Data"
'## Parameters.Add "Report: Historical: Designer: GAR TAC MC Table Sept 2001: Export Data","_Desc"
'## Parameters.Add "Reports","_Catalog"
'## Parameters.Add "2","_Action"
'## Parameters.Add "1","_Quit"
'## Parameters.Add "Historical\Designer\GAR TAC MC Table Sept 2001","_Report"
'## Parameters.Add "1","_ACD"
'## Parameters.Add "1110","_Top"
'## Parameters.Add "1140","_Left"
'## Parameters.Add "9585","_Width"
'## Parameters.Add "8955","_Height"
'## Parameters.Add "The report Historical\Designer\GAR TAC MC Table Sept 2001 was not found on ACD 1.","_ReportNotFound"
'## Parameters.Add "*","_BeginProperties"
'## Parameters.Add "11;19","Main Splits/Skills"
'## Parameters.Add "11;19","Other Splits/Skills"
'## Parameters.Add "1/11/2006-1/14/2006","Dates"
'## Parameters.Add "1","Day Shift"
'## Parameters.Add "1","Night Shift"
'## Parameters.Add "*","_EndProperties"
'## Parameters.Add "*","_BeginViews"
'## Parameters.Add "*","_EndViews"
'## Parameters.Add "C:\Documents and Settings\wooi\Desktop\EOW-4.txt","_Output"
'## Parameters.Add "44","_FldSep"
'## Parameters.Add "0","_TextDelim"
'## Parameters.Add "True","_NullToZero"
'## Parameters.Add "True","_Labels"
'## Parameters.Add "True","_DurSecs"

On Error Resume Next

cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Historical\Designer\GAR TAC MC Table Sept 2001")

If Info Is Nothing Then
If cvsSrv.Interactive Then
MsgBox "The report Historical\Designer\GAR TAC MC Table Sept 2001 was not found on ACD 1.", vbCritical Or vbOKOnly, "Avaya CMS Supervisor"
Else
Set Log = CreateObject("AVSERR.cvsLog")
Log.AutoLogWrite "The report Historical\Designer\GAR TAC MC Table Sept 2001 was not found on ACD 1."
Set Log = Nothing
End If
Else

b = cvsSrv.Reports.CreateReport(Info,Rep)
If b Then

Rep.Window.Top = 1110
Rep.Window.Left = 1140
Rep.Window.Width = 9585
Rep.Window.Height = 8955



Rep.SetProperty "Main Splits/Skills","11;19"

Rep.SetProperty "Other Splits/Skills","11;19"

Rep.SetProperty "Dates","1/11/2006"

Rep.SetProperty "Day Shift","1"

Rep.SetProperty "Night Shift","1"




b = Rep.ExportData("C:\Documents and Settings\wooi\Desktop\EOW-4.txt", 44, 0, True, True, True)





Rep.Quit



If Not cvsSrv.Interactive Then cvsSrv.ActiveTasks.Remove Rep.TaskID
Set Rep = Nothing
End If

End If
Set Info = Nothing
'## cvs_cmd_end

End Sub

i just want read the line 64 and change the date
Rep.SetProperty "Dates","1/11/2006"

i no idea how to do this.plz guide me thanks.
vino at 2007-11-11 17:28:52 >
# 5 Re: change the specific line
There are a lot of 'commented' lines, but even so, I can't find any reference to 'cvsSrv' so ...I might/must be missing something.

Phil, Marco, Paul, etc ... over to you ...
gupex at 2007-11-11 17:29:53 >