Graphical menu for batch files.

August 19, 2009 at 12:28:53
Specs: Windows XP Pro SP3
Someone knows any tool that can easily create a launch menu in graphic style? (and doesnt require any installation)

I have developed a bat to moderate my 7 years old son in his ativities in the web. With passing of the time this bat became elaborated and I want to set a prettier menu to launch user options.

I had already made pretty menus to bat using html + activeX resources (WinXP SP1), but I am using now SP3, and it blocks attempts to launch applications from a HTML page.

Would appreciate any suggestion.

See More: Graphical menu for batch files.

Report •

August 19, 2009 at 16:55:25

I have an idea, but i don't know whether it applies to what you want.

Put this Code into a batch file and run it.

echo **************************
echo * This is a menu *
echo **************************
echo 1 - Start Monitoring
echo 2 - View Monitor Files
echo 3 - Exit

That there will display the information after the Echo.
You may already know how to do this but i don't know that so I'll carry on explaining.
From that you can set a variable and IF statement to check your answer then link to a certain area.
Heres the code for that (which would go Underneath the code above)

Set /p Choice=>
IF %Choice% == 1 Goto MONITOR
IF %Choice% == 2 Goto VIEW
IF %Choice% == 3 Goto EOF

Code for monitoring
Code for viewing

Now i can't test that to double check, because I'm currently on a Linux system. But it should work. Thats basically a Menu. You can use echo and symbols or letters to create a nice looking menu.
Echo. This will create a blank line
echo ******** The Stars are just for effect. Mess around with it.

If this isn't what your looking for, I'm sorry.
But with that, you can add as many menu items as you want for all sorts of things. Also, you can add a password field in there so your son won't be able to run the bat file without that password.

The pros for this is that you won't need to mess around with HTML or other software to create something. Even though it's in DOS and it ain't really perfect. You can create some nice menus in there.

Hope this helps.

Need BatchFile Help ?
Msg me :)

Report •

August 19, 2009 at 18:04:52
Mattio, I thank you for your good wish, but I want a graphical style menu that allows use of the mouse. There must be some handy tool tailored for this need.

Personally it dont matter to me, but people in general are so habituated to graphical aplications that they get shocked when they see a text mode application. They find strange and reject it at first sight.

Report •

August 20, 2009 at 06:08:54
Then you're out of luck if you want to stick only to batch files.

VBScript can spawn an Internet Explorer window, and use that to display a web-like GUI, though.

Report •

Related Solutions

August 20, 2009 at 08:50:13
Razor, perhaps my words were not clear (my skill in English is not up to the mark).
I need a menu to launch applications (exe, com, bat), not links to web.

In the next months I will be very occupied with other pressing duties. I am not able to learn any programming language by now. That is why I am looking for an easy solution for a very specific need. I hope that somewhere in the net there is a simple tool that can handle this simple task.

Report •

August 20, 2009 at 09:09:20
I need a menu to launch applications (exe, com, bat), not links to web.
Don't confuse the interface with the behavior. Your script can do anything it wants, even if it uses Internet Explorer as the interface.

Report •

August 20, 2009 at 09:33:04
For this your better off using VB.
In VB you can drag and drop buttons and text fields whatever you want.
& it's very easy to learn so you won't have to spend a long time reading up code for it. You can get lots of simple tutorials on youtube and by searching on google.

Also, VB can be compiled into 1 .exe file so it's easy to just run & drag onto external memory.

Need BatchFile Help ?
Msg me :)

Report •

August 20, 2009 at 22:02:21
Mattio: thank you the encouragement. I will really examine the practicability of spent some time on this effort.

Razor: can we launch an executable or a batch (in our own computer) by clicking on a html link, without editing registry?

Report •

August 21, 2009 at 11:35:32
No, but you can use VBScript to spawn an instance of IE, and then monitor the events raised in IE's DOM.

I had a little time this afternoon, so I threw together this crude example:

Option Explicit
Dim ie, shell, ieQuit, list
Set list = CreateObject("Scripting.Dictionary")
With list
  'Add your elements here. The display value first, then the action
  .Add "Command Prompt", "cmd"
  .Add "C:\text.txt", "notepad c:\text.txt"
  .Add "Calculator", "calc"
  .Add "Paint", "mspaint"
End With
Set shell = CreateObject("WScript.Shell")
Set ie = WScript.CreateObject("InternetExplorer.Application", "IE_")
ieQuit = False

WScript.Quit Main

Function Main()
  Dim doc, menu, li, a, l
  Set doc = ie.Document
  Set menu = doc.getElementByID("menu")
  For Each l In list
    Set li = doc.createElement("li")
    Set a = doc.createElement("a")
    a.innerHTML = l
    a.href = list(l)
    Set a.onClick = GetRef("RunCMD")
    li.appendChild a
    menu.appendChild li
  Next 'l
  'Main() must now sleep until the IE window closes.
  Do Until ieQuit
    WScript.Sleep 1000
End Function

Sub ConfigIE(ie)
  Dim ul
  With ie
    .Navigate "about:blank"
    .Document.Title = "Some Menu Thing"
    .ToolBar        = False
    .StatusBar      = False
    .Width          = 800
    .Height         = 500
    With .Document.ParentWindow.Screen
      ie.Left = (.AvailWidth  - ie.Width ) \ 2
      ie.Top  = (.Availheight - ie.Height) \ 2
    End With
    Set ul = .Document.createElement("ul") = "Menu"
    ie.Document.body.appendChild ul
    .Visible = True
  End With
End Sub

' **** Event Handlers ****
Sub RunCMD()
  ie.Document.parentWindow.event.returnValue = False
  shell.Run ie.Document.parentWindow.event.srcElement.href, 1, False
End Sub

Sub IE_OnQuit()
  ieQuit = True
End Sub

Report •

August 21, 2009 at 19:47:58
Razor, thank you very much for your help. This VBscript will certainly be usefull in my purpose. You save me a lot of time in searching the web, looking for a needle in a haystack. Thank you.

Report •

Ask Question