Can I use the mouse in a batch menu?

February 20, 2011 at 10:40:59
Specs: Windows 7 XP \vista, na
Hi, I have created a batch file which uses the following format:

:: ------------------------------------- menu ------------------------------------------

:mainmenu
CLS
ECHO Main Menu
ECHO ---------
ECHO [1] Install Office 2010
ECHO.

:ch-main
SET /P mm=Please Select:
ECHO.

IF /I %mm%==1 GOTO inst-off
GOTO ch-main

:inst-off
:: "%tools%\office tools\" are set
START /D "%tools%\office tools\" office2010.exe
GOTO mainmenu

:EOF

:: -----------------------------------------------------------------------------------------------------------

What i'm after is being able to click the menu option and have the batch file perform the action required as if i'd typed the number in the menu...

Any clues?


See More: Can I use the mouse in a batch menu?

Report •


#1
February 20, 2011 at 12:11:30
You can't interact with a batch script using mouse since batch is command line driven only.

Report •

#2
February 20, 2011 at 15:59:03
What IVO said. There might be a third party utility to do what you want, but I don't know of one off hand. If you want to script a mouse driven menu, learn VBScript or JScript.

How To Ask Questions The Smart Way


Report •

#3
February 20, 2011 at 21:24:09
I wrote a batch utility that may be of interest:

http://judago.webs.com/downloads.ht...


Edit: By which I mean that it can accept mouse and keyboard input.

I also renamed it (twice) since I posted...


Report •

Related Solutions

#4
February 21, 2011 at 00:15:13
Judago,

Are you developing these batch utulities yourself? (sorry bad english)
If you are, wow verry nice!

I tried CmdMenuSel.exe it pretty cool but I dont understand it abit :/

I mean what can I do with it? When I do:

CmdMenuSel 0c0a "This is line 1" "This is line 2"

It is cool to see I can click with my mouse on it =)!
But like I asked before what is it for?

Kind Regards,

MUs

Happy is ONE who says I am an OttoMAN.


Report •

#5
February 21, 2011 at 00:20:32
Are you developing these batch utulities yourself?

Yes.

If you are, wow verry nice!

I'm getting better, but the older ones are quite scary underneath ;)

But like I asked before what is it for?

I'm not sure what you mean, perhaps you want to know how you can tell what was chosen... If so it returns an errorlevel (along the lines of choice).

CmdMenuSel 0c0a "This is line 1" "This is line 2"
echo %errorlevel%


Report •

#6
February 21, 2011 at 00:37:21
Thanks!

Now I'm understanding it :)
Be sure I'm going to use this tool alot!

Respect man for developing these utilities by yourself ;)

Kind Regards,

Happy is ONE who says I am an OttoMAN.


Report •

#7
February 21, 2011 at 00:46:07
I dont know but I think I found a bug :(

::Batch.bat

@echo off
:MENU
cls
cmdmenusel.exe fcf0 "www.google.com" "www.youtube.com"
if %ERRORLEVEL%==1 goto 1
if %ERRORLEVEL%==2 goto 2
goto MENU

:1
cls
start iexplore.exe www.google.com
goto MENU

:2
cls
start iexplore.exe www.youtube.com
goto MENU

Now when I choose a option and hit enter or space it does work fine, but when I click with my mouse (left click) it does open the choosen webpage 2-3 times?

How can I fix this?

Happy is ONE who says I am an OttoMAN.


Report •

#8
February 21, 2011 at 01:23:07
It's not so much a bug as a design flaw, it only detects button down not button up. Your script loops back before you release the button and thus returns again. I'll change it to detect button up as well.

Report •

#9
February 21, 2011 at 01:34:54
Oh ok I can't wait :)

Edit: After the command start iexplore.exe I have a wait pause (1 second) and then it does open 1 time :)

Happy is ONE who says I am an OttoMAN.


Report •

#10
February 21, 2011 at 03:01:33
@MU

Changed, same link.

If you have any more problems start a new thread or PM me, we shouldn't be spamming this thread.


Report •

#11
February 21, 2011 at 04:57:25
Ok :)

Thank-you for your time.

Happy is ONE who says I am an OttoMAN.


Report •

#12
February 21, 2011 at 13:58:00
Hmmmm...What surprising for me is that I already read the entire site on Monday, December 27, 2010 approx 12:50 AM (IST) and copied few stuffs (Sorry) . at that time i didn't noticed that the site owner is You.The calender stuff was amezing, i already shown that to all my co-workers here and all they said was "This is unbelievable".

i would say Thank you. I learned a lot from your site on how batch files are processed.i still have some of your pages saved on my tutorials folders

Subhash Chandra.


Report •


Ask Question