I've found the following script handy for usage with an HTA:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan08/hey0130.mspx
My question is...how can I cause the message displayed
("Searching ....") to flash every couple seconds while it's
processing; and then stop flashing when it's finished?
Just want to spruce up my HTA a bit. Any suggestions would be greatly
appreciated.
Thanks!
- Dave
Use Flash. With CS3 it is a match made in heaven for applications on
the web.
> I've found the following script handy for usage with an HTA:
Firstly HTA is a red-herring. HTA's are evil and best avoided. What
you asked for literally can be done in a web-compliant fashion,
without needing that sort of necromancy. Web techniques apply to HTAs
OK, some HTA techniques are (thankfully!) forbidden for web use.
Find a good JavaScript tutorial. (M$oft isn't - they're too busy
pushing proprietary tweaks, not standards).
Study two things: How to do simple visual effects by dynamic CSS
changes, and using JavaScript's .SetTimeout() method to drive things
with intervals. The rest is just a bit of practice and legwork in
coding your scripts.
If you get stuck, try asking in comp.lang.javascript
Don't use VBScript. Don't ever use it for web work (client-side or
server-side). It's an ugly language, anything it can do, JavaScript or
JScript can do better. Mostly though, using J(ava)Script gives you
some hope of working on other browsers, client-side VBScript limits
you and your users to IE only.
Flash would be ridiculous overkill for this.
Yes a simple image swap from an animated gif to a static one. Or you can
do it with style, IE does support blink so you could toggle color with
setInterval...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">
<title>Text Only</title>
<style type="text/css">
#blinker{ color: #88f; text-decoration: blink; }
</style>
<script type="text/javascript">
function done(){
var el=document.getElementById('blinker');
// IE has problems with setAttribute on 'style'
// el.setAttribute('style','color: #f00; text-decoration: none;');
// set directly
el.style.color='#f00';
el.style.textDecoration='none';
el.firstChild.nodeValue="Done!";
}
function countdown(){
var t=setTimeout("done()",10000); //10 seconds
}
// attach event after page loads
if( window.addEventListener ) {
window.addEventListener('load',countdown,false); //legacy
} else if( document.addEventListener ) {
document.addEventListener('load',countdown,false); //proper
} else if( window.attachEvent ) {
window.attachEvent("onload", countdown); //IE only
}
</script>
</head>
<body>
<p>
Simple example of a blinker.
<span id="blinker">Working...</span>
</p>
</body>
</html>
> If you get stuck, try asking in comp.lang.javascript
>
> Don't use VBScript. Don't ever use it for web work (client-side or
> server-side). It's an ugly language, anything it can do, JavaScript or
> JScript can do better. Mostly though, using J(ava)Script gives you
> some hope of working on other browsers, client-side VBScript limits
> you and your users to IE only.
>
> Flash would be ridiculous overkill for this.
For Travis all roads lead to flash.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Thanks for all the responses.
I was hoping there was something simple like:
<blink>flashing text here</blink>
But this doesn't work. I believe it's an issue with the BLINK element
not working in IE 6.
Thanks for the code Jonathan, but it doesn't work on my machine. Plus,
that amount of code is overkill for simply wanting to make some text
flash. I think I'll shelf this idea.
Thanks again.
- Dave
> But this doesn't work. I believe it's an issue with the BLINK element
> not working in IE 6.
The code to do blinking is pretty simple.
It's just that people who think this is a good idea find it hard to
type, after c.i.w.a.h have got to them and broken their fingers.
I accomplished the blinking text in VBScript with the code below. The big
problem I encountered is that wscript.sleep doesn't work in an HTA, so I
used the the PING command with -n option. You can roughly say one second
for each -n.
The code below will blink the words until notepad is closed.
Set oExec = oShell.Exec("notepad.exe")
i = 1
Do While oExec.Status = 0
idMsgArea.InnerHTML = "Words to blink"
oShell.Run "ping.exe -n 2 127.0.0.1", 0, True
i = i + 1
loop
Tom K.
But setTimeOut does... In HTAs you can call VBScript and J(ava)Script
interactively. If it's quick and dirty I tend to use VBScript. If there's
much heavy lifting involved, J(ava)Script.
>
Thanks again.
- Dave
>
Don't cave so fast. After you do it once, you will have it for posterity..
> I was hoping there was something simple like:
>
> <blink>flashing text here</blink>
Hey, I'll do the blinking around here.
--
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project: http://improve-usenet.org
Blinky: http://blinkynet.net
>
> "Highlander" <tron...@msn.com> wrote in message
> news:44fe76be-0c7a-484b...@s8g2000prg.googlegroups.com...
> On Feb 15, 11:17 am, "Jonathan N. Little" <lws4...@central.net> wrote:
>
> >
>
> Thanks for all the responses.
>
> I was hoping there was something simple like:
>
> <blink>flashing text here</blink>
>
> But this doesn't work. I believe it's an issue with the BLINK element
> not working in IE 6.
>
> Thanks for the code Jonathan, but it doesn't work on my machine. Plus,
> that amount of code is overkill for simply wanting to make some text
> flash. I think I'll shelf this idea.
>
What about a small animated gif? Think about its natural
advantages: for little code, it flashes and annoys, it does not
resize and it is a bit of a bother to implement. <g>
--
dorayme
Or Flash!
<html>
<HEAD>
<TITLE>This is the Application Caption</TITLE>
<HTA:APPLICATION ID="oApp"
APPLICATIONNAME="Splash Screen"
BORDER="thick"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
CAPTION="YES"
ICON=""
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal">
<style type="text/css">
.textBlack {
color : #000000;
}
.textRed {
color : #CC0000;
}
</style>
<SCRIPT type="text/javascript">
var bBlinkON = false;
function SwapColors(valIN)
{
if (valIN.className=='textBlack')
valIN.className='textRed';
else
valIN.className='textBlack';
return;
}
function Init()
{
var fSC = function (){
SwapColors(window.document.getElementById('spanToBlink'))};
var UpdateTime = window.setInterval(fSC,1000);
}
function Terminate()
{
window.clearTimeout();
}
</SCRIPT>
</HEAD>
<body onload="Init(); return false;">
<div><span id="spanToBlink" class="textBlack">This is my blinking Text!</span>
</div>
</body>
</html>
Ha! Got you to admit the disadvantages! I knew this would flush
you out and trap you finally, you slippery old dog.
--
dorayme
Paint Shop Pro has an Animation Shop that can
do that fairly simply. I expect there are also other
programs available.
And yes, BLINK is a Netscape tag that's almost
never used because, like MARQUEE, it's irritating.
You might also try limiting the groups you post
to next time. You've set off a barage of inflammatory
wiseacreing by mentioning HTAs in a non-VBS group. :)
> And yes, BLINK is a Netscape tag that's almost
> never used because, like MARQUEE, it's irritating.
Did you say Marquee? Interested in car races?
--
dorayme
You failed to read the thread, I sad Flash a long long time ago....
One wouldn't really have to read the thread to figure that...
--
Neredbojias
Riches are their own reward.
You mean that earlier on you admitted that Flash was (to quote
the words your reply was to) "for little code, it flashes and
annoys, it does not resize and it is a bit of a bother to
implement". I am sorry I missed that earlier admission.
--
dorayme
Thanks Mike! Your code works.
Now the question is, how do I insert your javascript code into the HTA
that I referred to:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan08/hey0130.mspx
The resulting HTA needs to have both VBScript and javascript code.
What I'm looking for is the HTA to have a blank span initially; and
then when I click the button, the text of my choosing appears, and it
starts blinking in the manner that your javascript code commands it to
do.
Thanks!
- Dave
http://www.microsoft.com/technet/scriptcenter/resources/qanda/jan08/hey0130.mspx
Thanks!
- Dave
Hi, Dave
If you don't already have it, download the HTA HelpOMatic.hta from
here:
http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=hta&DisplayLang=en
A basic HTA looks like this:
<html>
<head>
<title>Put your window title bar here</title>
<script language="vbscript">
'Putting this script here prepositions the window.
'Windowstate=Maximize would override this.
Const wdDlg = 600, htDlg = 380 ' dialog size
Const pxLeft = 100, pxTop = 100 ' positioning
window.ResizeTo wdDlg,htDlg
window.MoveTo pxLeft,pxTop
</SCRIPT>
<HTA:APPLICATION
ID="Put your ID here"
APPLICATIONNAME="Put your application name here"
SCROLL="yes"
SINGLEINSTANCE="no"
WINDOWSTATE=""
>
</head>
<SCRIPT Language="VBScript">
</SCRIPT>
<SCRIPT Language="JScript">
</SCRIPT>
<body>
</body>
</html>
The script near the beginning is something I've picked up in the M$
scripting newsgroup -- By being before the <HTA: ... > element, it
positions and sizes the HTA window before it is desplayed.
You can sprinkle <script> ... </script> blocks essentially anywhere
between the <head> and </html> tags. Each script block can specify
the language it uses; other languages like Perl, Python, Ruby, Rex,
and others can be installed. One hta can use a mixture of all the
scripting languages you have installed. Placing all the scripts in
front of the <body> tag helps with readability
You probably already know that subroutines and functions can be
specified to run when certain events associated with some object
occur. For example, the HTML for a button can specify a subroutine
name and arguments to be passed when the button's OnClick event is
invoked. Besides specifying the language, the <script ...> tag can
specify an object and an event name; the script within this script
block will only be executed in response to this event. Details of the
<script > element syntax is here:
http://msdn2.microsoft.com/en-us/library/ms535892(VS.85).aspx#
Functions and subroutines within the <script> ... </script> blocks are
only executed when they are called. The same is true when the <script
...> tag indicates that it is for a specific event for a specific
object. All other script is executed as it is encountered. You might
call this script the main program, although it can be parts of many
<script> ... </script> blocks in many languages. The blinking code
makes use of this:
> <SCRIPT type="text/javascript">
> var bBlinkON = false;
Variable bBlinkON is defined outside any function/sub, so it is a
global variable available immediately to any line of JScript executed
at a later time.
Some of the things you have to do are:
-copy the JScript blocks to some place ahead of your <body ... > tag.
-modify your <body ... > tag to set up event handlers.
-modify the script to use your span's ID.
-Add a button & click handler to modify the text in the span.
As demonstrated in the blinking code, you can get a reference to your
span with code like:
window.document.getElementById('spanToBlink')
As with most elements, this element has an innerhtml property which
you can change to any text you want.
If you find the HTA helpOMatic.hta handy, you can customize it --
adding selection items and HTML blocks and associated script blocks or
modifying the current ones to your liking.
-Paul Randall
missing a closing >
> </head>
wrong! no elements allowed between </head> and </body>
> <SCRIPT Language="VBScript">
> </SCRIPT>
> <SCRIPT Language="JScript">
> </SCRIPT>
the above script elements should be moved before the </head>
> <body>
> </body>
> </html>
[...]
Thanks for the detailed response Paul.
I already have a good deal of experience creating HTAs, but using
VBScript code only. I've got no experience working with javascript. So
when Paul came up with the blinking text solution in javascript,
that's where I'm a little fuzzy - how to incorporate the javascript
code into my HTA.
I had already created an HTA which combined Paul's javascript code and
my own VBscript code; and I've got it close to working the way I want
it to - but not quite:
<html>
<head>
<TITLE>This is the Application Caption</TITLE>
<HTA:APPLICATION ID="oApp"
APPLICATIONNAME="Application Name Here"
BORDER="thick"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
CAPTION="YES"
ICON=""
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal">
<style type="text/css">
.textBlack {color : #000000;}
.textRed {color : #CC0000;}
</style>
</head>
<SCRIPT type="text/javascript">
var bBlinkON = false;
function SwapColors(valIN)
{if (valIN.className=='textBlack')
valIN.className='textRed';
else
valIN.className='textBlack';
return;}
function Init()
{var fSC = function (){
SwapColors(window.document.getElementById('spanToBlink'))};
var UpdateTime = window.setInterval(fSC,1000);}
function Terminate()
{window.clearTimeout();}
</SCRIPT>
<SCRIPT Language = "VBScript">
Sub DisplayText_OnClick
DataArea.InnerHTML = "Text of my choosing here."
End Sub
</SCRIPT>
<!--
<body onload="Init(); return false;">
-->
<body>
<div>
<input type="button" value="Blink Text" onclick="Init()">
<p>
<span id="spanToBlink" class="textBlack">This is my blinking Text!</
span>
</div>
<p>
<input name= "DisplayText" type="button" value="Display Text"><p>
<span id=DataArea></span>
</body>
</html>
If you notice in the VBScript subroutine 'DisplayText_OnClick', I'm
able to specify the text of my choosing:
DataArea.InnerHTML = "Text of my choosing here."
This is what I can't figure out how to do in the javascript function.
On the VBScript side, when I click the button 'DisplayText', text is
displayed in the span area; which was initially blank. I want the
javascript code to work the same way. In that when I click the button
'Blink Text', the span area, which was initially blank, will now
display blinking text.
...when Paul came up with the blinking text solution in javascript...
I meant to say MIKE, not Paul. MikeB posted the blinking text solution
in javascript earlier in this thread.
function Terminate()
{window.clearTimeout();}
</SCRIPT>
- Dave
I'm not good with JScript or styles. Hopefully someone else can help
you.
In theory, changing the contents of the span to an empty string should
eliminate the blinking text. VBScript can do that with:
DataArea.InnerHTML = "Text of my choosing here."
and
DataArea.InnerHTML = ""
As currently written, your script blinks all text in the specified
span and any text that may follow. I don't think that is what you
want.
I have a feeling that the sample script Mike gave you left something
out. I'm thinking the purpose of
var bBlinkON = false;
is to give you a variable that you can just toggle between True and
False in order to have the contents of the span blink or not.
It happens to everyone :-)
Scripts can be placed almost anywhere in the main HTA elements:
<html>
<script language="vbscript">
MsgBox "Entered <html> element"
</script>
<head>
<script language="vbscript">
MsgBox "Entered <head> element"
</script>
<title>
<script language="vbscript">
MsgBox "Scripts don't work within the title element"
</script>
Title: Script placement within HTA
</title>
<HTA:APPLICATION
ID="oHTA"
APPLICATIONNAME="Put your application name here"
SCROLL="yes"
SINGLEINSTANCE="no"
WINDOWSTATE=""
<script language="vbscript">
MsgBox "Scripts are ignored in <HTA:> element"
</script>
>
</head>
<script language="vbscript">
MsgBox "Exited <head> element"
</script>
<body>
<script language="vbscript">
MsgBox "Entered <body> element"
</script>
<input id=Test1 class="button" type="button"
value="Test 1" name="Test1" onClick="Test1.vbs">
<br>
<script language="vbscript">
MsgBox "One button should now be displayed in the HTA window"
</script>
<input id=Test2 class="button" type="button"
value="Test 2" name="Test2" onClick="Test2.vbs">
<br>
<script language="vbscript">
MsgBox "Two buttons should now be displayed in the HTA " & _
"window. VBScript's message box is modal - it blocks " & _
"the use of controls in the HTA window, or even " & _
"repositioning the HTA window. It would be interesting " & _
"to see an expanded test HTA that mixes languages and " & _
"demonstrates ways to pass variables between languages and " & _
"access functions and subroutines of alien languages."
</script>
</body>
<script language="vbscript">
MsgBox "Exited <body> element"
</script>
</html>
The statement
> Scripts can be placed almost anywhere in the main HTA elements:
and most of the samples are correct and valuable. But there is at
least one position, where <script> isn't allowed: between </head>
and <body>.
http://www.w3.org/TR/html4/struct/global.html#edef-HTML
To add something more productive:
<html>
<head>
<hta:application id = "search"
/>
<title>search</title>
<meta http-equiv = "content-type" content="text/html; charset=iso-8859-1"/>
<meta http-equiv = "content-script-type" content = "text/vbscript"/>
<style type = "text/css">
.stdBtt
{ width: 80;
}
.Meta
{ color: red;
}
</style>
<script language = "VBScript"
type = "text/vbscript"
>
'<![CDATA[
Option Explicit
''= globals
' ============================================================================
Dim gCursor : gCursor = Empty
Dim nCnt : nCnt = Empty
''= start searching
' ============================================================================
Sub doStart()
gCursor = document.body.style.cursor
nCnt = 0
pMsg.InnerTEXT = "Searching ... " & nCnt
document.body.style.cursor = "wait"
Worker
End Sub
''= do the work step by step
' ============================================================================
Sub Worker()
If nCnt >= 10 Then
pMsg.InnerTEXT = "Idle"
pMsg.Style.Color = "black"
document.body.style.cursor = gCursor
Else
nCnt = nCnt + 1
pMsg.InnerTEXT = "Searching ... " & nCnt
If 0 = (nCnt Mod 2) Then
pMsg.Style.Color = "blue"
Else
pMsg.Style.Color = "red"
End If
window.setTimeout "Worker", 500, "VBScript"
End If
End Sub
''= refreshes the HTA page, which includes re-running any Windows_Onload code
' ============================================================================
Sub reloadHTA()
location.reload True
End Sub
']]>
</script>
</head>
<body>
<hr />
<input id = "bttStart" class = "StdBtt" type = "BUTTON" value = "Start" onclick =
"doStart">
<hr />
<input class = "StdBtt Meta" type = "BUTTON" value = "reload" onclick = "reloadHTA">
<hr />
<p id = "pMsg">
Idle
</p>
</body>
</html>
I came up with a blinking text solution in VBScript:
<html>
<head>
<TITLE>This is the Application Caption</TITLE>
<HTA:APPLICATION ID="oApp"
APPLICATIONNAME="Application Name Here"
BORDER="thick"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
CAPTION="YES"
ICON=""
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal">
</head>
<SCRIPT Language = "VBScript">
Dim sLoopStop, sTotals
sLoopStop = False
Sub CountEvents
DisplayText
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")
Set colEvents = objWMIService.ExecQuery("Select * From
Win32_NTLogEvent")
For Each objProcess in colEvents
i = i + 1
Next
sTotals = "Total events: " & i
StopLoop
End Sub
Sub DisplayText
IF sLoopStop = True Then
DataArea.InnerHTML = _
"<font color='green' face='Arial' size='4'><b>" & _
"Completed!!" & sTotals & "</b></font>"
Else
BlankText
ccSleep 1
RedText
End IF
End Sub
Sub BlankText
DataArea.InnerHTML = ""
End Sub
Sub RedText
DataArea.InnerHTML = _
"<font color='red' face='Arial' size='4'><b>" & _
"Processing..." & "</b></font>"
ccSleep 1
DisplayText
End Sub
Sub StopLoop
sLoopStop = True
End Sub
Sub ccSleep(seconds)
Set objShell = CreateObject("WScript.Shell")
cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul"
objShell.Run cmd,0,1
Set objShell = nothing
End Sub
</SCRIPT>
<body>
<input type="button" value="Display Text" onclick="DisplayText">
<p>
<input type="button" value="Stop Loop" onclick="StopLoop">
<p>
<hr>
<span id=DataArea></span>
</body>
</html>
It works fine, but now there's a new problem. Once the text starts
blinking, that's all the HTA does. I wanted additional processing to
be executing while the text is blinking.
When I click the 'Display Text' button, the 'CountEvents' subroutine
begins. It calls the 'DisplayText' subroutine, and the loop between
subroutines begins; the text starts to blink. But the additional code
in the 'DisplayText' subroutine - the WMI portion - never executes.
If I understand this correctly, this is due to the fact that by
default, when you call a procedure, once the procedure has finished
executing, control returns back to the code that called the procedure,
and execution picks up from there.
So is there any way around this? Any suggestions would be greatly
appreciated. Thanks!
- Dave
My intent was to create an HTA that demonstrates what is/is not
allowed by M$, not what is/is not allowed by the HTML standard. It is
difficult to tell whether Microsoft's failure to enforce the standard
is a feature or a bug. Microsoft's documentation is typically so poor
that I often feel that trial and error is the only way explore a
product's capabilities. Much like a blind man trying to figure out
what an elephant is and how to use it ;-)
-Paul Randall
"ekkehard.horner" <ekkehar...@arcor.de> wrote in message
news:47ba9be3$0$2292$9b4e...@newsspool4.arcor-online.net...
There are too many problems with this to 'fix' it. So, I took a stab
at what I think you want using the setTimeout approach (I hate the
ping kludge for timing - plus, it leaves no time for processing).
I think you you want to consider something more like this ...
<html>
<!-- put your HTA header Here -->
<SCRIPT Language = "VBScript">
Dim objWMIService, bLoopStop, nTotals, bBlank, sRedHTML, sGrnHTML
Sub initiate
sRedHTML = "<font color='red' face='Arial' size='4'><b>" & _
"Processing ...</b></font>"
sGrnHTML = "<font color='green' face='Arial' size='4'><b>" & _
"Completed!! Total Count: nTotals</b></font>"
bBlank = True
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
DataArea.InnerHTML = "Ready"
end sub
Sub CountEvents
Set colEvents = objWMIService.ExecQuery(_
"Select * From Win32_NTLogEvent")
nTotals = nTotals + colEvents.count
if bBlank then
DataArea.InnerHTML = sRedHTML
else
DataArea.InnerHTML = ""
end if
bBlank = not bBlank
if not bLoopStop then
setTimeout "CountEvents", 250, "vbscript"
else
DataArea.InnerHTML = Replace(sGrnHTML, "nTotals", nTotals)
end if
End Sub
</SCRIPT>
<body onload=initiate>
<input type="button" value="Display Text"
onclick="bLoopStop=False:CountEvents">
<p>
<input type="button" value=Stop onclick="bLoopStop=True">
Thanks Tom this works great! There's just one more thing I need.
Is there a way to tell when the 'colEvents.count' is finished, stops
incrementing, and the value of 'nTotals' does not go any higher? Then
at that point, 'bLoopStop' is set to 'True', and the 'Completed'
message is displayed.
Essentially I'd like a way for the blinking text to stop
programmatically, as an alternative to hitting the "Stop" button.
Thanks again!
- Dave
{snip code}
> > - Show quoted text -
>
> Thanks Tom this works great! There's just one more thing I need.
>
> Is there a way to tell when the 'colEvents.count' is finished, stops
> incrementing, and the value of 'nTotals' does not go any higher? Then
> at that point, 'bLoopStop' is set to 'True', and the 'Completed'
> message is displayed.
>
> Essentially I'd like a way for the blinking text to stop
> programmatically, as an alternative to hitting the "Stop" button.
>
> Thanks again!
>
> - Dave
I hadn't followed this whole thread, so I missed your full
intentions. I just reviewed it to try to better understand. Now I
realize that what you are actually trying to accomplish CANNOT be done
easily. The problem is that the underlying process hogs all of the
process time, such that there is no time left to process the text
blink. To have the text blink while the main process is working, the
two must be run asynchronously (in two separate threads) - which is
just not done simply in script.
It is reasonably easy to launch an asynchronous process, but
communicating its results back to the calling routine is complicated.
It's also an issue to determine if the process has finished. A
temporary file could be used to retrieve the result or a registry key
could be used, as well. Michael Harris also published an approach
some years back that uses an IE 'pipe', which has some advantages, but
is even more complicated.
One approach to launching the asynchronous process is to use Execute
method of the Shell.Application and then monitor the PID that results
to see if it's still in existence. Though I can describe the process,
I've never done it, so it would take some work to get it right - time
I don't have at the moment. Another approach is to use the
Wscript.Shell's Exec method, but that presents an ugly command console
window as it runs. There are probably others.
As I said, I don't have time to explore this anymore now, but might be
able to get back to you sometime in the future (maybe in a few days -
maybe). Sorry.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
OK, here is what I was able to put together. It uses the windows
showModelessDialog method as the 'asynchronous' process to show the
flashing text. As you can probably see, it's rather an involved
undertaking.
<html>
<!-- Your HTA header goes here -->
<SCRIPT Language = "VBScript">
Dim g_sGrnHTML, g_MsgArea
Sub Runit
DataArea.InnerHTML = "<font face='Arial' size='4'><b>" _
& "Running</b></font>"
nLeft = screenleft : nTop = screentop
set g_MsgArea = window.showModelessDialog("about:blank", null, _
"dialogLeft:" & nLeft & "px;dialogTop:" & ntop _
& "px;dialogHeight:100px;dialogWidth:400px;" _
& "center:no;scroll:no;status:no;resizable:no")
with g_MsgArea.document
.open
.writeln "<html><head><title>Working - patience please"
.writeln "</title></head><SCRIPT Language='VBScript'>"
.writeln "Dim g_bBlank, g_sRed"
.writeln "sub startit"
.writeln "g_sRed=""<br><font color=red face=Arial size=4>" _
& "<center><b>Processing ...</b></center></font>"""
.writeln "setInterval ""Blink"", 250, ""vbscript"" "
.writeln "end sub"
.writeln "Sub Blink"
.writeln " if g_bBlank then"
.writeln " MsgArea.InnerHTML=g_sRed"
.writeln " else"
.writeln " MsgArea.InnerHTML="""""
.writeln " end if"
.writeln " g_bBlank=not g_bBlank"
.writeln "end sub"
' *DO NOT* remove the 'unnecessary' concatenation from next line
.writeln "</" & "script><body onload='startit'>"
.writeln "<span id=MsgArea></span></body></html>"
.close
Do Until .ReadyState = "complete" : Loop
End with
g_sGrnHTML = "<font color='green' face='Arial' size='4'><b>" & _
"Completed!! Total Count: nTotals</b></font>"
setTimeout "CountEvents", 50, "vbscript"
end sub
Sub CountEvents
Dim n, i
strComputer = "."
Set oWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set cEvents = oWMI.ExecQuery("Select * From Win32_NTLogEvent")
'
' This loop is just here to slow things down as an example of a
' long running process
'
for i = 1 to 100*cEvents.count
n = n + 1
next
'
DataArea.InnerHTML = Replace(g_sGrnHTML, "nTotals", cEvents.count)
g_MsgArea.close
End Sub
</SCRIPT>
<body onload=Runit>
<input type="button" value=" Run " onclick="Runit">
<p><hr><p><span id=DataArea></span></body></html>
IHTH - I actually enjoyed the challenge of putting it together. I
learned a bunch.