Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTA VBScript Animated Gif Freezes Up

Status
Not open for further replies.

pshelfo

IS-IT--Management
Apr 27, 2004
16
US
I have the following HTA code which includes a VBScript that runs an animated gif to show that a backup operation is in process. I already run the vbscript with the animated gif succesfully but when I try to use HTA to add a better GUI everything runs fine except when the backup copy begins. I have had to create a 5 second time just to see the new display with the gif. The animated gif works for 5 seconds and then freezes up while the copy occurs. Once the copy finishes the success window appears and the script ends. Can anyone shed light and why and how to handle this within an HTA window?

<SCRIPT LANGUAGE="VBScript">
Sub Window_onLoad
window.resizeTo 350,200
End Sub
</SCRIPT>

<BODY>
</BODY>

<html>
<head>
<title>Network Backup</title>

<HTA:APPLICATION
ID="netbackup"
APPLICATIONNAME="Network Backup"
ICON = "disk.ico"
SINGLEINSTANCE="yes"
WINDOWSTATE="Normal"
SCROLL = "no"
>
</head>


<script Language="VBScript">

intButtonCount = 1

Sub RunYes
document.body.InnerHTML = "<center><p><b>**Backup in Progress**<p><img border=""0"" alt="""" src=""timer.gif""><p>Please wait ..."


Dim dtmStartTime

dtmStartTime = Now
idTimer = window.setTimeout("runscript", 5000, "VBScript")
End Sub

Sub runscript
' Network Drive Conditional Folder Creation

Set FSO = CreateObject("Scripting.FileSystemObject")

Set objNetwork = CreateObject("Wscript.Network")
strUserName = objNetwork.UserName


FSO.CopyFolder "c:\My Documents", "\\servername\filename"

'Clean-Up and Completion Message
document.body.InnerHTML = ""
document.body.InnerHTML = "<center><p><b>** Backup Completed Successfully! **<p><img border=""0"" alt="""" src=""check.gif"">"
End Sub



Sub RunNo


End Sub


</script>

<body>
<center>
<font color="black" face="Times New Roman" size="3"> <b>Do You Want to Start a Network Backup?</font>
<p>
<input id=runbutton class="button" type="button" value="Yes" name="clear" onClick="RunYes">
<input id=runbutton class="button" type="button" value="No" name="No" onClick="RunNo">
<p>
<font color="red" face="Times New Roman" size="3"> <b>** Remember to Close Outlook **</font>
</body>
 
What I would do is have your HTA create an IE popup that shows the GIF. IE is more robust than MSHTA.EXE.

(HTAs look like they run in IE but they do not)

Simple code to do what I am saying.

Code:
Sub ShowBackupGIF
set x = createobject("internetexplorer.application")
x.navigate2 "about:blank" : x.toolbar = false : x.menubar = false : x.statusbar = false : x.Resizable = True : x.visible = True
x.document.write "<body bgcolor='#BDD5F2' border=0>"
x.document.write "<center><p><b>**Backup in Progress**<p><img border=""0"" alt="""" src=""timer.gif""><p>Please wait ..."
x.document.write "</body>
End Sub

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top