Question

I'm trying to create a sort of persistent menu to place at the top of my WinPE image that offers: power off, restart and console access- In that order.

I have tried switching the order, switching names, switching images, changing associations, nothing I do will make more than two work at a time. Either power and admin work and restart doesn't, or restart and power work and admin doesn't, or admin and restart work and power doesn't.

Is there a limit on the amount of image inputs you can have or something?

<SCRIPT LANGUAGE="VBScript">

    ' Resize and center the window
    ' ==========================================================
        sub DoResize
            window.resizeTo 175,75
            screenWidth = Document.ParentWindow.Screen.AvailWidth
            screenHeight = Document.ParentWindow.Screen.AvailHeight
            posLeft = (screenWidth - 100) / 2
            posTop = (screenHeight - 100) / 2    
            window.moveTo posLeft, posTop
        end Sub

        DoResize()
    ' ==========================================================

</SCRIPT>

<HEAD>
  <TITLE> </TITLE>
  <HTA:APPLICATION ID="oMyApp"
    APPLICATIONNAME="Options"
    INNERBORDER="no"
    BORDER="none"
    CAPTION="no"
    SCROLL="NO"
    SHOWINTASKBAR="NO"
    SINGLEINSTANCE="yes"
    SYSMENU="NO"
    WINDOWSTATE="normal">
</HEAD>
<BODY>
<body background="Options.png">
<SCRIPT LANGUAGE="VBScript">

Option Explicit

Sub Power

    Dim objShell
    Dim ret

    Set objShell = CreateObject("Wscript.Shell")

    ret = MsgBox("Shut Down Computer?", vbYesNo, "Power Off")

    If ret = 6 Then
        objShell.Run "x:\windows\system32\cmd.exe /c wpeutil shutdown", 0, True
    ElseIf ret = 7 Then
        Exit Sub
    End If

End Sub

Sub Reboot

    Dim objShell
    Dim ret

    Set objShell = CreateObject("Wscript.Shell")

    ret = MsgBox("Restart Computer?", vbYesNo, "Restart")

    If ret = 6 Then
        objShell.Run "x:\windows\system32\cmd.exe /c wpeutil reboot", 0, True
    ElseIf ret = 7 Then
        Exit Sub
    End If

End Sub

Sub Admin

    Dim objShell
    Dim ret

    Set objShell = CreateObject("Wscript.Shell")

    ret = InputBox("Enter Admin Password", "Password Required")

    If ret = "password" Then
        objShell.Run "x:\windows\system32\cmd.exe /k"
    ElseIf Not ret = "password" Then
        MsgBox "Incorrect Password", vbOKOnly, "Access Denied"
    End If

End Sub

</SCRIPT>
<input type="image" img src="power.png" name="power" size="48" onclick="Power">
<input type="image" img src="restart.png" name="reboot" size="48" onclick"Reboot">
<input type="image" img src="config.png" name="config" size="48" onclick="Admin">
</BODY>
Était-ce utile?

La solution

There's a syntax error in the second <input> tag. Replace

<input type="image" ... onclick"Reboot">

with

<input type="image" ... onclick="Reboot">
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top