vbscript - How to loop every 15 minute and get data from .txt at the same time? -


i have code below taking data .txt , loop every 15 minutes. i'm experimenting value of 9000 shorten time while testing. if successful set 900000 15 minutes.

dim fso, path, file, recentdate, recentfile, objfso, objoutputfile, objtextfile, strtext,  = 0 while = 0     set fso = createobject("scripting.filesystemobject")     set recentfile = nothing     each file in fso.getfolder("c:\users\id\documents\data-dtl\vbs\").files         if (recentfile nothing)             set recentfile = file         elseif (file.datelastmodified > recentfile.datelastmodified)             set recentfile = file         end if     next      if recentfile nothing         wscript.echo "no recent files"     else         'wscript.echo "recent file " & recentfile.name & " " & recentfile.datelastmodified         const forreading = 1         set objfso = createobject("scripting.filesystemobject")          set objoutputfile = objfso.createtextfile("temp.txt")         set objtextfile = objfso.opentextfile("dtl.txt", forreading)         strtext = objtextfile.readall         objtextfile.close         objoutputfile.write strtext          set objoutputfile = objfso.createtextfile("dtl.txt")         set objtextfile = objfso.opentextfile("temp.txt", forreading)         strtext = objtextfile.readall         objtextfile.close         objoutputfile.write strtext          set objtextfile = objfso.opentextfile("c:\users\id\documents\data-dtl\vbs\" & recentfile.name, forreading)         strtext = objtextfile.readall         objtextfile.close         objoutputfile.write strtext          objoutputfile.close     end if      wscript.sleep (9000) loop 

at first code runs, in loop i'm getting error

name redefined 'forreading'

move const forreading = 1 line directly below dim statement @ top of script.

as says, trying redefine constant each time go around loop, makes no sense.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -