loading
 
Refreshing notepad
Robo from United States  [3 posts]
16 year
Hello,

I am storing the variables( cog and angle) in a seperate notepad using vb program. I need to refresh notepad(i.e delete all the values and again start to write the values) for every certain amount of time say 10 sec.
So after every 10 sec, I need to delete all the previous values and start storing new values.

Any help regarding how to implement?

Code for writing into notepad.

Dim fi
  Dim fso
   Dim intVar
  set fso = CreateObject("Scripting.FileSystemObject")
  set fi = fso.OpenTextFile("c:\text.txt", 8, true)
  intVar = 1
  if err.number = 0 then
    ' Append the cog coordinates to the file.
    ' You can specify other variables here
    intVar = intVar+1
    fi.writeLine intVar & "." & GetVariable("X_1") & ":" & GetVariable("Y_1") & ", " & GetVariable("X_2") & ":" & GetVariable("Y_2")  & "," & GetVariable("X_3") &":"& GetVariable("Y_3") & "," & GetVariable("X_4") & ":" & GetVariable("Y_4")
    fi.writeLine "Angle_1:" &GetVariable("Angle_1") &"," & "Angle_2:" & GetVariable("Angle_2") & "," & "Angle_3:" &  GetVariable("Angle_3") & "," & "Angle_4:" &  GetVariable("Angle_4")
    
    fi.close
  end if
  set fi = nothing
  set fso = nothing
Anonymous 16 year
Hi,

Use the CreateTextFile to overwrite the file and then use the seconds(now)mod 10 to cause it to execute every 10 sec

if Second(Now) mod 10 = 0 then
    Set fi = fso.CreateTextFile("c:\\testfile.txt", True)
else
     set fi = fso.OpenTextFile("c:\\text.txt", 8, true)
end if

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index