These are some good examples here. Thanks for sharing them. I tried running the example from Inforequester from within an hta in an effort to learn more about scripting. The code produces the following error: Object required 'Wscript' . I tinkered with it for over an hour to get that error cleared to no avail. This little program/script launches Notepad and IE as expected but that's all it does.
Question # 1: Why is it producing that error?
Below is my source code:
Code:
<html>
<head>
<script language="VBScript">
Sub RunProgram1
Set objShell = CreateObject("WScript.Shell")
objShell.Run "notepad.exe C:\Documents and Settings\UsersName\My Documents\First_HTA_Automation_Script\ReadMe.txt"
End Sub
Sub RunProgram2
Set IE = CreateObject("InternetExplorer.Application")
set WshShell = CreateObject("WScript.Shell")
IE.Navigate "https://mysuperwebsite.com/login.jsp"
IE.Visible = True
WScript.Sleep 6000
IE.Document.All.Item("fld_userName").Value = "[email protected]"
IE.Document.All.Item("fld_password").Value = "superPassword"
WshShell.AppActivate "IE"
WshShell.SendKeys "{ENTER}"
End Sub
</script>
</head>
<body>
<button onclick="RunProgram1">Launch Notepad</button> <p>
<br>
<button onclick="RunProgram2">Launch IE</button> <p>
</body>
</html>
Question # 2: Can anybody direct me to some good online tutorials for using VBscripts from HTA's (Hypertext Applications) ??
My ultimate goal with VBscript is to automate the testing and routine tasks that I have to do with web browsers and I would like to house and launch my VBscripts from HTA's.
THANK YOU in advance.