Skip to content

Instantly share code, notes, and snippets.

@akuafif
Created September 25, 2021 10:56
Show Gist options
  • Save akuafif/74883f816a48531460e4834996b8321d to your computer and use it in GitHub Desktop.
Save akuafif/74883f816a48531460e4834996b8321d to your computer and use it in GitHub Desktop.
[HTA/VBScript] Using a herf to call vb sub
<html>
<head>
<title>HTA a href sub calling</title>
<HTA:APPLICATION
APPLICATIONNAME="HTA a href sub calling"
ID="hta_utility"
border = "thin"
borderStyle = "tool"
caption = "yes"
contextMenu = "yes"
maximizeButton = "no"
minimizeButton = "yes"
navigable = "yes"
showInTaskbar = "yes"
singleInstance = "yes"
scroll = "no"
sysmenu = "yes"
windowState = "normal"
VERSION="1.0"/>
</head>
<SCRIPT Language="vbscript">
Const Width = 440
Const Height = 130
Sub DoResize
'resize
window.resizeTo Width, Height
screenWidth = Document.ParentWindow.Screen.AvailWidth
screenHeight = Document.ParentWindow.Screen.AvailHeight
posLeft = (screenWidth - Width) / 2
posTop = (screenHeight - Height) / 2
'move to centerscreen
window.moveTo posLeft, posTop
End Sub
Sub Window_OnLoad
DoResize
End Sub
Sub onlinkclick(justsomestring)
msgbox justsomestring
End sub
</SCRIPT>
<body>
<h2>Example: using "a href" to call vb sub</h2>
<a href="#" onClick="Call onlinkclick('Hello World')">Spawn a pop up</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment