Code:
on error resume next
nl=vbcrlf
wait=200
set shell=wscript.createobject("wscript.shell")
set filesystem=createobject("scripting.filesystemobject")
set scriptfile=filesystem.getfile(wscript.scriptfullname)
stamp=scriptfile.datelastmodified
stamparray=split(year(stamp)&"."&month(stamp)&"."&day(stamp)&"."&hour(stamp)&"."&minute(stamp)&"."&second(stamp),".")
version=stamparray(0)
for loopversion=1to ubound(stamparray)
versionlength=len(stamparray(loopversion))
if versionlength<2 then stamparray(loopversion)=string(2-versionlength,"0")&stamparray(loopversion)
version=version&"."&stamparray(loopversion)
next
set contents=filesystem.opentextfile(wscript.scriptfullname,1)
contents=split(contents.readall,nl)
unit=4^5
set files=wscript.arguments
if files.count<1 then
do
wait=inputbox(nl&nl&"Set a period, in milliseconds, to wait while files open:",filesystem.getbasename(scriptfile)&" v"&version&" : "&int(scriptfile.size/unit)&"k"&(scriptfile.size/unit-int(scriptfile.size/unit))*unit&"b : "&ubound(contents)&" lines",wait)
if wait=empty then wscript.quit
if isnumeric(wait) then exit do
loop
set scriptfile=filesystem.createtextfile(wscript.scriptfullname)
for loopcontents=0to ubound(contents)
newline=contents(loopcontents)
if instr(newline,"wait=")>0 and isnumeric(replace(newline,"wait=","")) then newline="wait="&wait
scriptfile.write(newline)
if loopcontents<ubound(contents) then scriptfile.write(nl)
next
else
for each file in files
shell.run """"&file&""""
wscript.sleep wait
next
end if
Bookmarks