then copy and past this
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Option Explicit
Dim oWSH, oEXE, oIE, iHeight, iWidth, sHTML, sEXE
Set oWSH = CreateObject("WScript.Shell")
Set oEXE = CreateObject("Scripting.Dictionary")
Set oIE = WScript.CreateObject("InternetExplorer.Application", "IE_")
' § Add Programs to the dictionary §
oEXE("Notepad") = "%SystemRoot%\system32\notepad.exe"
oEXE("Calculator") = "%SystemRoot%\system32\calc.exe"
oEXE("Paint") = "%SystemRoot%\system32\mspaint.exe"
oEXE("DOS Window") = "%comspec%"
' § Configure the Internet Explorer window §
oIE.Navigate "about:blank"
Do Until oIE.ReadyState = 4
WScript.Sleep 100
Loop
iHeight = 60 + (oEXE.Count * 25)
iWidth = 300
oIE.document.parentWindow.resizeTo iWidth, iHeight
oIE.document.title = "Click on a button..." & String(50, Chr(160))
oIE.addressBar = False
oIE.toolBar = False
oIE.statusBar = False
oIE.document.body.scroll = "no"
sHTML = "
"
' § Loop through the dictionary & create application buttons §
For Each sEXE in oEXE
sHTML = sHTML & "
"
Next
' § Write the generated HTML to Internet Explorer §
sHTML = sHTML & "
" ' § Loop through the dictionary & create application buttons §
For Each sEXE in oEXE
sHTML = sHTML & "
"
Next
' § Write the generated HTML to Internet Explorer §
sHTML = sHTML & "
oIE.document.body.innerHTML = sHTML
' § Create references for the buttons created above §
For Each sEXE in oEXE
oIE.document.getElementById(sEXE).onClick = GetRef("Click")
Next
' § Make the Internet Explorer windows visible & focus it §
oIE.visible = True
oWSH.AppActivate oIE.document.title
' § Sit in an endless loop until Internet Explorer is closed §
Do
WScript.Sleep 100
Loop
' § Terminate the VBScript when the IE window is closed §
Sub IE_OnQuit
WScript.Quit
End Sub
' § When a button is clicked, launch the associated program §
Sub Click
Dim sProgram
sProgram = oEXE(oIE.document.parentWindow.event.srcElement.id)
oWSH.Run """" & sProgram & """", 1, False
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
then flie save as menu.vbs
and open it. it is going to look like this
Great!
ReplyDelete