Flashing message in an HTA

T

Travis Newbury

Just want to spruce up my HTA a bit. Any suggestions would be greatly
appreciated.

Use Flash. With CS3 it is a match made in heaven for applications on
the web.
 
A

Andy Dingley

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.
 
J

Jonathan N. Little

Andy said:
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.

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>
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.
 
H

Highlander

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>




For Travis all roads lead to flash.

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
 
A

Andy Dingley

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.
 
M

MikeB

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
Don't cave so fast. After you do it once, you will have it for posterity..
 
D

dorayme

"MikeB said:
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>
 
T

Travis Newbury

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>

Or Flash!
 
M

MikeB

Don't cave so fast. After you do it once, you will have it for posterity..


<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>
 
M

mayayana

I don't know if this is the best option, but what
about a simple animated GIF with some frames
text and some frames blank? Then you could just
show the GIF or hide it.

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. :)
 
J

Jonathan N. Little

MikeB said:
<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">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Did you insert this for some purpose? Not required for JavaScript to
work on IE...
 
D

dorayme

"mayayana said:
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?
 
M

MikeB

Jonathan N. Little said:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Did you insert this for some purpose? Not required for JavaScript to work on
IE...
It's not for IE.. HTA's are hosted by mshta.exe, not iexplorer.exe. It's
just some standard nomenclature inthe HTA tag. It will work perfectly without
any of it.
 
T

Travis Newbury

Ha! Got you to admit the disadvantages! I knew this would flush
you out and trap you finally, you slippery old dog.

You failed to read the thread, I sad Flash a long long time ago....
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Sat, 16 Feb 2008 13:41:20 GMT
Travis Newbury scribed:
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...
 
D

dorayme

<[email protected]
Travis Newbury said:
You failed to read the thread, I sad Flash a long long time ago....

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.
 
H

Highlander

"MikeB" <m.byerleyATVerizonDottieNettie> wrote in message






<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>

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top