Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB in WinPE

Status
Not open for further replies.

jeffrowski

Technical User
Jan 16, 2007
13
GB
Hi!

I posted a thread a couple of days ago, and was having trouble creating a password screen (HTA file).
Im trying to run this script inside WinPE 2004. I've found out over the past couple days that certain dll's are required for it to run.

I've got the script partly working, but my command to call another script file is not working. I know the script is good, it works perfectly well when I run it in windows. When I try to run it in WinPE, not very much seems to happen!
 
Does the IE object work in WinPE 2004? If so, I would spawn an instance of IE to display the login screen and then return the entered information to the VBScript to process accordingly.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
HTAs don't use IE, they use MSHTA.exe and a number of components that it has in common with IE though.

Be aware that WinPE's MSHTA doesn't support IE's trust model though. This means that things like ADO just aren't going to work there.

It's easier to get VB6 programs working over there in a sense.
 
Well, here is the thing; the script runs perfectly in windows, but when it runs in PE it misses parts of the script out:

<html>
<head>

<title>logon</title>

<hta:application
id="MyApp"
applicationName="logon"
border="thick"
borderStyle="normal"
caption="yes"
contextMenu="yes"
icon=""
innerBorder="yes"
maximizeButton="yes"
minimizeButton="yes"
navigable="no"
scroll="yes"
scrollFlat="no"
selection="yes"
showInTaskBar="yes"
singleInstance="no"
sysMenu="yes"
version="1.0"
windowState="maximize"
>
</head>

<body>
<script language="vbScript">

' Globals
Dim sh
Dim nw
Dim fs
Dim rootDir
Dim sSettings
' Create useful COM objects
Set sh = CreateObject("Wscript.Shell")
Set nw = CreateObject("Wscript.Network")
Set fs = CreateObject("Scripting.FileSystemObject")



Sub RunScript
strAnswer = window.prompt("Please enter the technician code.", "code here please")
'If IsNull(strAnswer) Then
'Msgbox "You clicked the Cancel button"
If stranswer="1234" then
msgbox "Correct, now calling rebuild script.."
location= "imagex.hta"
Else
Msgbox "Incorrect, rebooting PC NOW"
location= "shutdown.hta"

End If
End Sub
</script>


<input id=runbutton class="button" type="button" value="run button" name="run_button" onclick="RunScript">
</body>
</html>


now, the sub runscript kind of works! It displays the box, expects you to put something in it, but then skips to the 'you clicked the cancel button' msgbox? It is really weird and I am stuck for ideas!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top