Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBScript use Windows Visual Styles

Tags:

vbscript

Is it possible to tell a VBScript to use Windows Visual Styles, so that any form components use Windows themed ones rather than classic ones? For example, to make a MsgBox show a styled button rather than a classic 3D raised square one.

This:

enter image description here

As opposed to this:

enter image description here

like image 912
Robert Wigley Avatar asked Oct 02 '15 17:10

Robert Wigley


People also ask

Does Microsoft support VBScript?

VBScript is a programming language included with Microsoft Internet Explorer. For other browsers, contact your vendor about support. VBScript 2.0 (or later) is recommended for use with Agent.

Does VBScript work in Windows 10?

Since Windows 10 build 16237: “VBScript is deprecated in Internet Explorer 11, and is not executed for web pages displayed in IE11 mode.

Does VBScript work in Windows 11?

Yes, Windows 11 supports VBScript files.


1 Answers

In HTA applications, A simple meta tag will turn on Visual Styles:

<META HTTP-EQUIV="MSThemeCompatible" CONTENT="yes">

This trick has seemed to disappear completely from Google search results, leaving this S/O question at the top!

In the case where a VBScript MsgBox is the culprit, one would have to modify wscript host to use visual styles. But for the sake of the post, you can easily make your own replica of a MsgBox using an HTA file, and turning on visual styles. I created an exact replica based off your screenshot:

msgbox.hta:

<html>
<head>
 <title>MsgBox Title</title>
 <META HTTP-EQUIV="MSThemeCompatible" CONTENT="yes">
 <HTA:APPLICATION ID="Custom MsgBox"
     APPLICATIONNAME="Custom MsgBox"
     BORDER="thin"
     BORDERSTYLE="normal"
     CAPTION="yes"
     CONTEXTMENU="no"
     ICON=""
     MAXIMIZEBUTTON="no"
     MINIMIZEBUTTON="no"
     SHOWINTASKBAR="no"
     SINGLEINSTANCE="no"
     SYSMENU="yes"
     SCROLL="no"
     WINDOWSTATE="normal"/>
 <script language="javascript">window.resizeTo(400,170);</script>
</head>
<body style="font-family:Arial;padding:20px 0 0 20px;background:rgb(180,240,230)">
 <p>MsgBox Body; lorem ipsum dipsum</p><br>
 <div align="right"><button onclick="window.close()" style="width:80px">OK</button></div>
</body>
</html>

It's small enough where you could echo it into an hta file right from a batch script, if you wanted to.

I hope this helps!

like image 176
Aaron Gillion Avatar answered Oct 22 '22 03:10

Aaron Gillion