VBScript icon indicating copy to clipboard operation
VBScript copied to clipboard

VBS in HTML (evil)

Open enkore opened this issue 13 years ago • 3 comments

Yeah I know embedding VBScript in HTML is evil, but I often need to work with such stuff :( However, even with VBScript installed Sublime Text 2 thinks that stuff inside

enkore avatar May 13 '12 11:05 enkore

Hey enkore, do you have an example of this? I can probably take a look and see what I can do - no promises! :)

In regards to the tmLanguage, I found this or this to be pretty helpful.

jsadeli avatar May 14 '12 17:05 jsadeli

Those files often have the extensions .hta (HTml Application), but it's also possible in normal HTML files. That basically looks like this:

<html>

<head>
<title>some crappy app</title>

<HTA:APPLICATION
  APPLICATIONNAME="BullShitOMeter"
  ID="objBullShitOMeter"
  SINGLEINSTANCE="yes"
  WINDOWSTATE="maximize"/>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<script language="VBScript">

Option Explicit

' global definitions

Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_CURRENT_USER  = &H80000001
const REG_SZ = 1
const REG_EXPAND_SZ = 2
const REG_BINARY = 3
const REG_DWORD = 4
const REG_MULTI_SZ = 7

Dim dlg
dim okB ' as integer
dim ynB ' as integer

Sub StartBSOM
    ' ...'
end sub

</script>
<body>
<!-- normal HTML -->
<div id="container">

</div>
>
<table width = "100%" >
    <tr>
        ...
    </tr>
</table>

</body>
</html>

So it is like the JavaScript-script-tag, except that it contains VBScript... Currently Sublime Text 2 treats everything inside a script-tag like JavaScript, so the syntax highlighting is pretty much botched up (comments are highlighted like strings and stuff like that)

enkore avatar May 15 '12 11:05 enkore

At first glance, looks like there would need to be at least a patch to the built in HTML.tmLanguage file to support other languages beside JavaScript. Another possibility would be to have a new syntax language, something like HTML (VBScript).

Also, sadly, my tmLanguage reading and editing mojo isn't high enough yet - would need to level up first.

jsadeli avatar May 15 '12 15:05 jsadeli