Hey, Scripting Guy! Question

Hey, Scripting Guy! How can I change the color of the scrollbars in an HTA?

-- IR

SpacerHey, Scripting Guy! AnswerScript Center

Hey, IR. How many times have you thought to yourself, “Gee, the Scripting Guy who writes that column is so smart; how come he isn’t rich?” (OK, true, you’ve probably never thought that. But just play along, OK?) Well, it turns out that there’s a very simple explanation for this: he’s too far out-of-touch with the modern world.

For example, last night the Scripting Guy who writes this column read about a company that converts your physical mail (you know, the kind that the post office delivers) to email. If you’re like most people, apparently you don’t have time to open up the mailbox and go through your mail. Well, thanks to this new company – which expects to soon become a multi-billion dollar company – that’s something you’ll never have to worry about. Instead of having mail delivered to your home or office, you can have your mail forwarded to this company. In turn, trained representatives will open each and every envelope, scan the items into the computer, and then send the scanned images to you via email. You’ll never have to touch a grimy old mailbox again!

It’s safe to say the Scripting Guy who writes this column would never have come up with an idea like that, not in million years. After all, he still trundles down to the mailbox every day, retrieves his own mail, and then – we hope you’re sitting down here – he opens his own envelopes and reads the actual physical contents of each letter! And he never, ever digitizes that mail! The flyer for the local hardware store? The solicitation from the Art Museum? The invitation to learn about real estate opportunities or to buy 1 get 1 free at the Mexican restaurant (Monday through Thursday, 12:00 PM to 2:00 PM only)? Gone, all gone. What is he thinking?!?

Note. To tell you the truth, he’s thinking, “Why in the world would I pay someone $20 a month (the subscription rate to this new service) to digitize all my mail and send it to me via email?” Sadly, it’s thinking like that which is helping to hold back the march of progress.

But you know what they say: it’s always easy to teach an old dog new tricks. (Or something like that; we weren’t paying very close attention when they said whatever it is they said.) With that in mind, rather than type in the code that shows you how to change the color of the scrollbars in an HTA we decided to get with the times, take a screenshot of our solution, and then present you with a digitized version of the script. Here you go, IR:

HTA


What’s that? Well, we’re not saying that it’s easy to read … did you try squinting your eyes a little? Give that a try.

You’re right; that just makes it worse, doesn’t it?

OK, so maybe our business model needs a little more work; among other things, we haven’t exactly figured out how to get people to pay $20 a month for the chance to get copies of scripts they won’t be able to read. With that in mind, and while we reassess the business plan, here’s an old-fashioned way of looking at the code:

<STYLE>
  BODY {scrollbar-face-color:red; scrollbar-arrow-color:blue; scrollbar-track-color:green }
</STYLE>

Yes, we know: it’s painful to have to read things in the old-fashioned way, isn’t it? On the bright side, though, at least there isn’t much to read here. As you can see, all we’re doing is defining a style for the body of our HTA; in particular we’re assigning values to three different properties:

Scrollbar-face-color, which sets or retrieves the color of the scroll box and scroll arrows of a scroll bar.

Scrollbar-arrow-color, which sets or retrieves the color of the arrow elements of a scroll arrow.

Scrollbar-track-color, which sets or retrieves the color of the track element of a scroll bar.

Best of all, the syntax for assigning a value to one of these properties is pretty simple: you just reference the property name followed by a colon followed by the assigned value (e.g., scrollbar-face-color:red). If we want to assign values to more than one property all we have to do is separate those individual properties using semicolons.

And not some kind of digitized, virtual semicolon. These are real semicolons, the kind that Ernest Hemingway used to use.

Note to the Scripting Editor. When you get back into town, make sure that Ernest Hemingway actually used semicolons. Also, see if you can out who Ernest Hemingway is.

Of course, some of you might be concerned that, having shown you how to set the preceding three scrollbar properties there’s now nothing left for you to learn on your own. Perish the thought! Here are some additional scrollbar properties that we haven’t worked with:

Scrollbar-3dlight-color, which sets or retrieves the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.

Scrollbar-base-color, which sets or retrieves the color of the main elements of a scroll bar, which include the scroll box, track, and scroll arrows.

Scrollbar-darkshadow-color, which sets or retrieves the color of the gutter of a scroll bar.

Scrollbar-highlight-color, which sets or retrieves the color of the top and left edges of the scroll box and scroll arrows of a scroll bar.

Scrollbar-shadow-color, which sets or retrieves the color of the bottom and right edges of the scroll box and scroll arrows of a scroll bar.

And what colors can you set these properties to? For starters, how about the colors found in the Cascading Style Sheets reference documentation?

Meanwhile, the Scripting Guy who writes this column has come up with a newer, and even better, idea: he’ll have people’s email forwarded to him, then he’ll print out those emails and pop them into the regular mail. Tired of getting too much email and too much spam? No problem; with this new service you’ll never get any email! To sign up for our introductory price of $19.95 a month, just send your credit card number to scripter@microsoft.com.

Note. This is the spot where the Scripting Editor would usually note, “Please do not send your credit card number to scripter@microsoft.com.” Because the Scripting Editor is out of town, we’ll take care of that for her: “Please do not send your credit card number to scripter@microsoft.com.” Send cash instead.