javascript - Progress bar on Copy Folder VBS -
i have following hta using vbscript copy folder 1 source folder destination folder. have a, far not working, progress bar made in css , javascript show progress. script copying folder succesfully, have not found way show progress.
i need find way show actual progress in progress bar when copying folder. have tried various methods using statement for each file in folder
without luck.
i know there other methods of showing progress bar, i.e windows progress bar, use own.
the following code samples in 1 hta, i've dividede sciprts better overview. hope helps.
the following code acutal copy folder vbscript:
<script language="vbscript"> sub setup dim fso, newfile, thisfile set fso = createobject("scripting.filesystemobject") folderdir = fso.getfolder("..\") dim wshshell, desktop, pathstring, objfso set objfso = createobject("scripting.filesystemobject") set wshshell = createobject("wscript.shell") desktop = wshshell.specialfolders("desktop") destination = objfso.getabsolutepathname(desktop) source = "c:\test\source" fso.copyfolder ""&source&"", ""&destination&"\", true end sub sub closeapp self.close end sub </script>
the copy script triggered onclick on image in hta script:
<hta:application applicationname="update" caption="no" scroll="no" innerborder="no" singleinstance="yes" icon="../images/icon_64.ico" showintaskbar="yes"> <body onload="progressbar(100,75);"> <table cellpadding=0 cellspacing=0 width="100%"> <tr> <td id="top_bar" height="25" width="100%" align="center">installation</td> </tr> <tr> <td align="center"> <br> <b>do want install program?</b><br> <br> <div style="width:150px"> <div id="slider" align="left"> <div id="sliderbar" ></div> <div id="progress" align="center"></div> </div> </div> <br> <img src="../images/installer.png" onclick="setup()">  <img src="../images/afslut.png" onclick="closeapp()"> <br> </td> </tr> </table> </script> </body>
furthermore have progress bar, made in css , javascript:
<style> #slider{ width:100%; height:12px; border:1px solid #000; overflow:hidden; background: #fff; } #sliderbar{ width:37%; height:12px; border-right: 1px solid #000; background-color: #66ff33; } #progress { font-family: arial; font-size: 10px; font-weight: bold; position: relative; top: -15px; } </style> <script language="javascript"> function progressbar(xx, yy){ var progress=math.round((yy*100)/xx); document.getelementbyid("sliderbar").style.width=progress+'%'; document.getelementbyid("progress").innerhtml=progress+'%'; document.title = progress+'% installed'; } </script>
i hope here can see easy way show use progress bar. last step in finishing script, pleased if can me out.
thanks reading!
Comments
Post a Comment