vsprogrammer
Programmer
Hi,
I am trying to write text back to a notepad file, the following code works, however, it keeps overriding the original value. So what I am doing is checking a checkbox and then reading the text that is associated with the checkbox and storing it back to the file for later use, ie.
(Using CitraText with VB coding)
For y = 1 To iCheckboxCount
returnStatus = ClickOnImage("Checkbox_Unchecked.bmp", LEFT_BUTTON, 1, 2, "NONE", USE_COLOR_VARIATION + USE_NEAREST_IMAGE, STANDARD_COLOR_TOLERANCE, 0)
'*READ WHAT THE ORDER NAME IS AND STORE IN A FILE FOR LATER
returnStatus = ReadText("Dummy_relative_area.relative", "MSSansSerif8_Bold", 2)
returnStatus = ReadText("Read_Order_Checkbox.relative", "MSSansSerif8_Bold", STANDARD_TIMEOUT)
If returnStatus <> SUCCESS Then
scriptStatus = SCRIPT_FAIL
Exit Sub
Else
TextRead = Replace(TextRead, "I", "l")
Dim FILE_NAME As String = "C:\Documents and Settings\vsnook\Desktop\OrderName.ini"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim sb As New System.Text.StringBuilder
sb.Append(TextRead)
Using writer As System.IO.StreamWriter = New System.IO.StreamWriter(FILE_NAME)
writer.Write(sb.tostring)
sb.End Using
Else
MsgBox("File Does Not Exist")
End If
End If
If returnStatus <> SUCCESS Then
Exit For
End If
Delay(".3")
Next y
****************** END CODE *****************
Any help would be appreciated!
Have a great day!
Vicky
I am trying to write text back to a notepad file, the following code works, however, it keeps overriding the original value. So what I am doing is checking a checkbox and then reading the text that is associated with the checkbox and storing it back to the file for later use, ie.
(Using CitraText with VB coding)
For y = 1 To iCheckboxCount
returnStatus = ClickOnImage("Checkbox_Unchecked.bmp", LEFT_BUTTON, 1, 2, "NONE", USE_COLOR_VARIATION + USE_NEAREST_IMAGE, STANDARD_COLOR_TOLERANCE, 0)
'*READ WHAT THE ORDER NAME IS AND STORE IN A FILE FOR LATER
returnStatus = ReadText("Dummy_relative_area.relative", "MSSansSerif8_Bold", 2)
returnStatus = ReadText("Read_Order_Checkbox.relative", "MSSansSerif8_Bold", STANDARD_TIMEOUT)
If returnStatus <> SUCCESS Then
scriptStatus = SCRIPT_FAIL
Exit Sub
Else
TextRead = Replace(TextRead, "I", "l")
Dim FILE_NAME As String = "C:\Documents and Settings\vsnook\Desktop\OrderName.ini"
If System.IO.File.Exists(FILE_NAME) = True Then
Dim sb As New System.Text.StringBuilder
sb.Append(TextRead)
Using writer As System.IO.StreamWriter = New System.IO.StreamWriter(FILE_NAME)
writer.Write(sb.tostring)
sb.End Using
Else
MsgBox("File Does Not Exist")
End If
End If
If returnStatus <> SUCCESS Then
Exit For
End If
Delay(".3")
Next y
****************** END CODE *****************
Any help would be appreciated!
Have a great day!
Vicky