Jump to content

Status Box WinPE HTA


randalldale

Recommended Posts

Hi Guys,

I'm trying to get a status box to run in my HTA file while install my OS that lets the user know what is going on without telling them the complete details. Has anyone been able to do such a thing? I have two status boxes that run inside of windows but will not work inside of WinPE.

here is my coding from one of them...

Thoughs?

Thanks

RD


<HTML>
<HEAD>
<TITLE>PC Installation</TITLE>
<HTA:APPLICATION ID="aIMAGECONF"
APPLICATIONNAME="myApp"
BORDER="normal"
BORDERSTYLE="normal"
CAPTION="yes"
ICON=""
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
VERSION="1.0"
WINDOWSTATE="normal"/>

<style type="text/css">

td {
font-family: Verdana, Helvetica, sans-serif;
font-size: 0.8em;
}

h3 {
font-family: Verdana, Helvetica, sans-serif;
font-size: 1.3em;
}

.imagemeta {
font-weight: bold;
}

#firstRow {color: #000000}
#anyRow {color: #AAAAAA}

#topBorder {
background: #002F63;
}

#middleContent {
width:100%;
height:90%;
float:left;
background:#fff;
padding-bottom:4px;
padding-top:4px;
}

#topRight {
height: 10%;
position: relative;
left: 1;
background:#efefef;
padding-bottom:10px;
}

#mainRight {
height: 90%;
position: relative;
left: 1;
background:#efefef;
padding-bottom:10px;
}

#statusbox {
background-color: #f3f3f3;
border-width: 0px;
overflow: auto;
}

#mainleft {
width: 20%;
height: 90%;
float:left;
background:#5196CD;
padding-bottom:10px;
}

</style>

<script language="VBScript">
Dim NewStatus, Status, CurrentStatus
Set fso = createobject("scripting.filesystemobject")
Set objWSHell = createobject("wscript.shell")

Function BuildImage
On Error resume Next
Set objWMI = GetObject("winmgmts:")
Set myEnum = objWMI.ExecQuery("SELECT * from Win32_ComputerSystemProduct")
For Each csp in myEnum
oComputerModel.innerHTML = ltrim(rtrim(csp.Name)) & " " & ltrim(rtrim(csp.Version))
oSerialNum.innerHTML = csp.identifyingnumber
Next
MsgBox "Test"
Document.frmMain.S1.value = Document.frmMain.S1.value & "Please wait"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "-----------------------------------"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "starting process"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "-----------------------------------"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "starting process"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "-----------------------------------"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "starting process"
Document.frmMain.S1.value = Document.frmMain.S1.value & vbCrlf & "-----------------------------------"
MsgBox "Test"
self.close
End Function

window.onload=GetRef("BuildImage")

</SCRIPT>

</HEAD>
<BODY marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" SCROLL="no">

<DIV ID="topBorder">
<img src="topHeader.gif" border="0" />
</DIV>

<DIV ID="middleContent">

<DIV ID="mainLeft">

</DIV>

<DIV ID="topRight">

<h3>Image Deployment</h3>
<TABLE ID="oImageInfo">
<TBODY>
<!-- <TR><TD>Image Name:</TD><TD class="imagemeta" id="oImageName"></TD></TR>
<TR><TD>Image Version:</TD><TD class="imagemeta" id="oImageVersion"></TD></TR> -->
<TR><TD>Computer Model:</TD><TD class="imagemeta" id="oComputerModel"></TD></TR>
<TR><TD>Computer Serial Number:</TD><TD class="imagemeta" id="oSerialNum"></TD></TR>
<TR><TD> </TD><TD> </TD></TR>

</TBODY>
</TABLE>
</DIV>

<DIV ID="mainRight">

<h3>Status</h3>
<FORM name="frmMain">
<TABLE ID="aTABLE">
<TR>
<form method="POST" action="--WEBBOT-SELF--">
<p><textarea rows="28" name="S1" cols="70"></textarea></p>
</TR>
</TABLE>
</FORM>
</DIV>

</DIV>

</BODY>
</HTML>

Link to comment
Share on other sites


Here you go. As you see, I used another HTA to launch this one. This is just a small window with an animated GIF in it. Then in the background, it runs the commands such as diskpart, writes to the MBR and reimages a drive. After the command is done and it closes and the HTA that launched it is always behind it.

  <Title>Full Recovery</Title>
<HTA:APPLICATION ID="FsSplashScreen"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="No"
SysMenu="No"
MaximizeButton="No"
MinimizeButton="No"
Border="none"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="no"
WindowState="Normal"
APPLICATIONNAME="FsCommandHta"
CONTEXTMENU="no"
Icon="%SystemRoot%\explorer.exe">
<STYLE type="text/css">
BODY
{
Font:9.25pt;
Font-weight:bold;
Font-family:helvetica,verdana,arial;
Color:#000080;
Text-Align:Center;
Vertical-Align:Middle;
Padding-Top:3;
Padding-Bottom:2;
Padding-Left:10;
Padding-Right:10;
background-image:url('resources\imagex.gif')
}
</STYLE>
<script Language='VBSCRIPT'>
'-> Resize And Move Window
Dim Wth :Wth = int(250)
Dim Hht :Hht = int(50)
window.ResizeTo Wth, Hht
MoveTo ((Screen.Width / 2) - (Wth / 2)),((Screen.Height / 2) - (Hht / 2))
Dim Tmr
Sub confirmation2
Dim A1 :A1 = window.confirm("Recovery Complete, Would you like to Restart now?")
If A1 = True Then CreateObject("WScript.Shell").Run("wpeutil Reboot"),0
End Sub
'-> Start The First Timer OnLoad, Three Second Wait Befor It Goes
'-> To The ClearTimer Function
Function Window_OnLoad()
document.focus()
Txt1.innerHTML= "Processing The Script Function Please Wait"
Tmr=setTimeout("ClearTimer()",3000)
Exit Function
End Function
'-> Process The First Command
Function ClearTimer()
'-> Object To Run The First Command Hidden, Uncooment To Make Active
Set objShell = CreateObject("WScript.Shell")
ObjShell.run "cmd /c diskpart /s x:\windows\system32\full_diskpart.txt",0,True
ObjShell.run "cmd /c c:\mbr 0 1 /h",0,True
ObjShell.run "cmd /c imagex /apply c:\image.wim 1 d:",0,True
Tmr=clearTimeout("")
'-> Place Your Code For confirmation2 Here Start
Call confirmation2()
'-> Place Your Code For confirmation2 Here End
Txt1.innerHTML= "Prepaparing To Close"
Tmr=setTimeout("ClearTimer2()",3000)
Exit Function
End Function
'-> Close The Hta Function
Function ClearTimer2()
Tmr=clearTimeout("")
window.close()
Exit Function
End Function
</SCRIPT>
<BODY Scroll='No'><TABLE><SPAN ID='Txt1'> </SPAN></TABLE></BODY>

Edited by Tripredacus
Link to comment
Share on other sites

Guys thanks for the input...

arwidmark I'm afraid I can't use the the MDT as my images are highly evolved and customized... 10 languages and 21 platforms...

Tripredacus also thanks as I have used an animatied gif in previous releases. I was looking for a bit more info for the end user rather than an animated gif.

I was showing the apply on the wim files and the RoboCopies but was asked to not give so much info and instead just annouce what was going on I.E. 'copying files' or 'loading OS' stuff like that. I use the code I posted during finishing as it does run inside of Windows and gives the user a list of info like 'Installing Roxio' and Installing USB 3.0 Drivers'. I was just hoping that someone has gotten some sort of frame or statusbox to work under WinPE so that I could show the same type of info.

Also I added another bit of code for a statusbox that I use inside of Windows in case someone wants it for their installs. It actually has a really clean look.

Thanks again,

RD


<HTML>
<HEAD>
<TITLE>PC Installation</TITLE>
<HTA:APPLICATION ID="aIMAGECONF"
APPLICATIONNAME="myApp"
BORDER="normal"
BORDERSTYLE="normal"
CAPTION="yes"
ICON=""
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
SYSMENU="no"
VERSION="1.0"
WINDOWSTATE="normal"/>

<style type="text/css">

td {
font-family: Verdana, Helvetica, sans-serif;
font-size: 0.8em;
}

h3 {
font-family: Verdana, Helvetica, sans-serif;
font-size: 1.3em;
}

.imagemeta {
font-weight: bold;
}

#firstRow {color: #000000}
#anyRow {color: #AAAAAA}

#topBorder {
background: #002F63;
}

#middleContent {
width:100%;
height:90%;
float:left;
background:#fff;
padding-bottom:4px;
padding-top:4px;
}

#topRight {
height: 10%;
position: relative;
left: 1;
background:#efefef;
padding-bottom:10px;
}

#mainRight {
height: 90%;
position: relative;
left: 1;
background:#efefef;
padding-bottom:10px;
}

#statusbox {
background-color: #f3f3f3;
border-width: 0px;
overflow: auto;
}

#mainleft {
width: 20%;
height: 90%;
float:left;
background:#5196CD;
padding-bottom:10px;
}

</style>

<script language="VBScript">
Dim NewStatus, Status, CurrentStatus
Set fso = createobject("scripting.filesystemobject")
Set objWSHell = createobject("wscript.shell")
Set wshnetwork = createobject("wscript.network")
Sub poststatus()
'******** Update the statusbox and scroll down so the last update is visible ********
statusbox.value = Status
NewStatus = Status & VbCrLf & "-----------------------------------" & VbCrLf & CurrentStatus
status = NewStatus
End Sub

Function BuildImage
On Error resume Next
Set objWMI = GetObject("winmgmts:")
Set myEnum = objWMI.ExecQuery("SELECT * from Win32_ComputerSystemProduct")
For Each csp in myEnum
oComputerModel.innerHTML = ltrim(rtrim(csp.Name)) & " " & ltrim(rtrim(csp.Version))
oSerialNum.innerHTML = csp.identifyingnumber
Next
Status = "Please Wait Building Hard Drive Structure"
CurrentStatus = "Adding Drivers"
poststatus
MsgBox "Test"
CurrentStatus = "Adding Operating System"
poststatus
MsgBox "Test"
CurrentStatus = "Adding SEP"
poststatus
MsgBox "Test"
CurrentStatus = "Adding Language"
poststatus
MsgBox "Test"
CurrentStatus = "Finishing Install"
poststatus
MsgBox "Test"
CurrentStatus = "Rebooting"
poststatus
MsgBox "Test"
self.close
End Function

window.onload=GetRef("BuildImage")

</SCRIPT>

</HEAD>
<BODY marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" SCROLL="no">

<DIV ID="topBorder">
<img src="topHeader.gif" border="0" />
</DIV>

<DIV ID="middleContent">

<DIV ID="mainLeft">

</DIV>

<DIV ID="topRight">

<h3>Image Deployment</h3>
<TABLE ID="oImageInfo">
<TBODY>
<TR><TD>Computer Model:</TD><TD class="imagemeta" id="oComputerModel"></TD></TR>
<TR><TD>Computer Serial Number:</TD><TD class="imagemeta" id="oSerialNum"></TD></TR>
<TR><TD> </TD><TD> </TD></TR>

</TBODY>
</TABLE>
</DIV>

<DIV ID="mainRight">

<h3>Status</h3>

<TABLE ID="aTABLE">
<TR>
<TD ID="statusrow" WIDTH="100%"><TEXTAREA cols="70" rows="28" id="statusbox" NAME="statusbox" READONLY="true" UNSELECTABLE="on"></TEXTAREA></TD>
</TR>
</TABLE>
</FRAME>
</DIV>

</DIV>

</BODY>
</HTML>

Link to comment
Share on other sites

Anything you can think of using HTML will work in the HTA (of course) and also you can use Flash in there too if you have access. I'm not sure about Flash embedding (I never tried it) but Flash Projectors work in there just fine.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...