Jump to content

Seattle

Member
  • Posts

    2
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Posts posted by Seattle

  1. I think you have problem with the images.txt file.

    Can you post your code here?

    <html>
    <!--
    '********************************************************************
    '*
    '* File: ImageXHTA.hta
    '* Author: geezery
    '* Big thanks to : greg & fisher
    '* Created: May 2007
    '* Version: .1
    '*
    '* Description: windows imaging platform
    '*
    '* Dependencies: tested on and for WinPE 2.0 with WMI, Scripting,
    '* XML, HTA packages, Imagex components
    '* Notes: Line 28 - might want to make this "normal" when you are
    '* testing and don't want the hta fullscreen
    '* Line 206 - Put your background image there if you want
    '********************************************************************
    -->

    <!****************************************************************************>
    <!* HTA Header >
    <!****************************************************************************>
    <HEAD>
    <TITLE>Imaging Application</TITLE>
    <HTA:APPLICATION
    BORDER = yes
    APPLICATION = Yes
    WINDOWSTATE = maximize
    INNERBORDER = No
    SHOWINTASKBAR = Yes
    SCROLL = No
    APPLICATIONNAME = "Windows PE Wizard"
    NAVIGABLE = Yes
    >
    <!-- external stylesheet -->
    <link rel="stylesheet" type="text/css" href="htastyle.css" />
    </HEAD>

    <!****************************************************************************>
    <!* Begin Script >
    <!****************************************************************************>
    <script Language=VBScript>

    '****************************************************************************
    '* Globals
    '* setup global script parameters
    '****************************************************************************
    Option Explicit
    Dim strTaskValue, objShell, objFso, strBody, objWmiService, strImgSrc, strOutPut, cmdImgInfo, cmdPartHD, tmpFile, j, strImages, strLocation
    Dim strIndx(), strNames()
    Set objShell = CreateObject("WScript.Shell")
    Set objFso = CreateObject("Scripting.FileSystemObject")
    Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")


    '-------------- Editable commands --------------
    ' Diskpart command
    cmdPartHD = "%comspec% /c diskpart /s F:\winpe\diskpart.txt"
    ' Image-X /info command. (xml-print)
    cmdImgInfo= "%comspec% /c imagex /info F:\images.wim"
    ' Default file, where to parse image list
    strImages = "F:\Winpe\images.txt"
    '------------------------------------------------

    '****************************************************************************
    '* Window_OnLoad
    '* load up behavior and preferences
    '* Read image files
    '* Parse indexes and filenames
    '****************************************************************************
    Sub Window_Onload
    readImages()
    strLocation = InputBox("Path to images.txt file:", "images.txt" , strImages)
    Call parseFile(strIndx, strNames, strLocation)
    self.Focus()
    strBody = "<div id='title'>Tetra Tech Deployment Center</div>" & "<BR><B>Select image to apply:</B><BR>"
    enumDirs
    End Sub

    '****************************************************************************
    '* enumDirs
    '****************************************************************************
    Sub enumDirs
    Dim colFilelist, objFile, strButtons, objShortcut, colTargetList, objTarget, x, y, strKey, strItem, k
    ReDim arrButtons(1,-1)

    'Reset display element style
    details.innerHTML = ""
    details.style.visibility = "hidden"

    'Create list
    For k = 0 To Ubound(strIndx)
    ReDim Preserve arrButtons(1,UBound(arrButtons,2)+1)
    arrButtons(0,UBound(arrButtons,2)) = strNames(k)
    arrButtons(1,UBound(arrButtons,2)) = "<Input type=radio name=radioList id='" & strIndx(k) & "' onClick=showRadioInfo>" & strNames(k) & "</BUTTON><BR>"
    Next

    'perform a a shell sort of the string array based on button label
    For x = 0 To UBound(arrButtons,2) - 1
    For y = x To UBound(arrButtons,2)
    If StrComp(arrButtons(0,x),arrButtons(0,y),vbTextCompare) > 0 Then
    strKey = arrButtons(0,x)
    strItem = arrButtons(1,x)
    arrButtons(0,x) = arrButtons(0,y)
    arrButtons(1,x) = arrButtons(1,y)
    arrButtons(0,y) = strKey
    arrButtons(1,y) = strItem
    End If
    Next
    Next

    'End of the list
    For x = 0 To UBound(arrButtons,2)
    strButtons = strButtons & "<tr><td id=buttonTd>" & arrButtons(1,x) & "</td></tr>"
    Next

    strBody = strBody & "<BR><HR><BR>"
    strBody = strBody & strButtons & "<BR><HR><BR><button class='defBtn' id=start Accesskey=S onclick=doTask(strTaskValue)><U>A</U>pply image</BUTTON><BR>"

    body.innerHTML = strBody
    End Sub

    '****************************************************************************
    '* doTask
    '* run task selected by radio button
    '****************************************************************************
    Sub doTask(doMe)
    Dim myInput
    Dim myError
    If doMe = "" Then
    MsgBox "You must choose image to apply first."
    Else
    If Instr(1, doMe, "gex /apply", 1) > 0 Then
    myInput = MsgBox("The hard disk of the computer will be formatted and the image will be applied to it."+Chr(13)+Chr(13)+"Continue?", 4)
    If myInput = 7 Then
    MsgBox "Aborted by user"
    Else
    doTask(cmdPartHD)
    objShell.Run doMe
    End if
    Else
    myError = objShell.Run(doMe, 1, True)
    End if
    End if
    End Sub

    '****************************************************************************
    '* readImages
    '* Imagex info-print -> file
    '****************************************************************************
    Sub readImages()
    'ObjShell.Run "%comspec% /c Dir " & chr(34) & strImgSrc & chr(34) & " > " & chr(34) & strOutPut & chr(34)
    ' Imagex /Info command
    ' ObjShell.Run "%comspec% /c Dir " & cmdImgInfo & " > " & chr(34) & strOutPut & chr(34)
    End Sub

    '****************************************************************************
    '* parseFile
    '* Parses the text inside <name> and <index> tags from text file.
    '****************************************************************************
    Sub parseFile(strIndx(), strNames(), strFile)
    Dim objTextFile, sReadLine, pos, pos2, i, tmpStr1
    i = -1
    Redim strNames(0)
    Redim strIndx(0)

    If objFso.FileExists(strFile) Then
    Set objTextFile = objFso.OpenTextFile(strFile, 1)
    Do While Not objTextFile.AtEndOfStream
    sReadLine = objTextFile.ReadLine
    ' indexit ja name haltuun
    pos2 = Instr(1, sReadLine, "<IMAGE", 1)
    pos = Instr(1, sReadLine, "<NAME>", 1)
    If pos2 > 0 Then
    i = i + 1
    Redim Preserve strIndx(i)
    Redim Preserve strNames(i)
    'strIndx(i) = Right(sReadLine, Len(sReadLine) - (pos2 + 9))
    tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos2 + 13))
    strIndx(i) = Left(tmpStr1, Len(tmpStr1) -2)
    End If

    If pos > 0 Then
    'strNames(i) = Right(sReadLine, Len(sReadLine) - (pos + 5))
    tmpStr1 = Right(sReadLine, Len(sReadLine) - (pos + 5))
    strNames(i) = Left(tmpStr1, Len(tmpStr1) -8)
    End If
    loop
    End If
    End sub
    '****************************************************************************
    '* showRadioInfo
    '****************************************************************************
    Sub showRadioInfo
    Dim objTextFile, Radio, strRadioValue, strDetails
    'set details and start element styles
    details.style.visibility = "visible"
    start.style.visibility = "visible"
    'find checked button
    For Each Radio in Document.getElementsByName("radioList")
    If Radio.Checked = True Then
    'create imaging command line from button id
    strTaskValue = "imagex /apply F:\images.wim " + Radio.Id + " c:"
    End If
    Next
    'post resulting html to details element
    Details.innerHTML = "<BR><table id='detailsTable'><tr><td>" & strDetails & "</td></tr></table><BR>"
    End Sub

    '****************************************************************************
    '* Reset
    '* reset the tool interface, also reloads the code (helpful for programming)
    '****************************************************************************
    Sub Reset
    Location.Reload(True)
    End Sub

    </Script>
    <!****************************************************************************>
    <!* End Script / Begin HTML >
    <!****************************************************************************>

    '<BODY background="pe.jpg">
    <DIV id=bg>
    <!-- <img src="pe.jpg"> -->

    </DIV>

    <DIV id=body></DIV>
    <DIV id=details></DIV>

    <DIV id=tools>
    <Button class = 'defBtn' id=cmd onclick=doTask('%comspec%')> CMD-Prompt </BUTTON>
    <Button class = 'defBtn' id=close onclick=self.close()> Close </BUTTON>
    <Button class = 'defBtn' id=reset onclick=reset> Refresh List</BUTTON>
    </DIV>
    </BODY>
    </HTML>

    <!****************************************************************************>
    <!* End HTML >
    <!****************************************************************************>

    ** Also, are these files supposed to be placed on the MappedDrive:\winpe\ folder? I keep getting an access denied when calling the HTA, even though the drive maps fine.

    I apologize for my newbiness :) I really do appreciate your help.

    Originally, I added these files to the winpe boot image and was able to call the HTA but that is when I receive the script error.

    Then I saw the note about creating a winpe folder in the image directory but now i am receiving access denied. :(

  2. Hello,

    First, I would like to say thanks to the OP for some fine work here :)

    Second, I am trying to use this in my PE Boot Image (WDS Server) and it sort-of works.

    PE Loads / Boots / Initializes / Maps the Drive / and then launches the program but I receive a script error.

    Error:

    Line: 54

    Char: 1

    Error: Invalid Syntax

    Code: 0

    It asks if I would like to continue running the script and I click yes.

    The interface comes up with no images listed.

    If you need more information, please let me know.

    Thanks!

×
×
  • Create New...