Wikipedia:Reference desk/Archives/Computing/2014 July 31

= July 31 =

Is there a easy way to create a batch menu?
I have a bunch of dos games here and I want to create batch that will have a menu that will open their folders.

I already have a txt file with all the folders in alphabetical order:

cd game1

cd game2

What would be a easy way to create a menu that goes like this:

Select the letter you want to go: 0- H

1- I

2- J

3- K

4- L

5- M

6- [show previous letters]

7- [show next letters]

Then after you select the letter

Select the game you want to open:

0- GAME1

1- GAME2

2- GAME3

3- GAME4

4- GAME5

5- GAME6

6- [go to letter selection]

7- [show previous games]

8- [show next games]

Selecting a game would make the batch type: cd gamefolder 201.78.142.165 (talk) 13:58, 31 July 2014 (UTC)


 * Are you running these games in a copy of MS-DOS on an old computer or VM? Or on DOS Box (and running on what?)? Or on Windows x32's DOS emu (Virtual DOS machine)? Or what? Nil Einne (talk) 14:03, 31 July 2014 (UTC)
 * Anyway  gives some examples for making menus in a batch file. It should work on MS-DOS (and I think FreeDOS) as well as Windows NT's cmd.exe (which means it can be used to launch DOS games in the VDM on any x32 version of Windows safe to use). I'm not sure DOSBox implements all those features for batch files. If it doesn't, then it may not work. You could of course run a batch file in cmd.exe (or anything else which supports them) and use them to launch DOSbox and the game. Nil Einne (talk) 14:13, 31 July 2014 (UTC)


 * I've made lots of menus like that using gfortran in the MS-DOS window on a Windows PC. You can even use the line drawing set in extended ASCII to make nice single or double lined boxes around the text, to make it look professional.  I suppose you could use gcc to do the same thing, but I hate C with a passion.


 * As far as how to do it, lots of GOTO statements are the easy way, with blocks of commands to display each menu (and contain the GOTO statements for whatever commands can be typed in there). I suggest you just let them type in the letter directly, rather than have them scroll through menus to find the proper number.  StuRat (talk) 14:12, 31 July 2014 (UTC)


 * Why would you do anything on an MS-DOS window other than play games on a Windows NT PC? AFAIK it's not even easy to access. Far better to just use cmd.exe or some other native command shell as 99.99% of programs would, just like batch files do. Nil Einne (talk) 14:15, 31 July 2014 (UTC)


 * You can put an icon to open an MS-DOS shell on your Desktop, or, even better, you can have the executable open it for you. StuRat (talk) 14:23, 31 July 2014 (UTC)
 * What I am using is dosbox wii version201.78.142.165 (talk) 16:26, 31 July 2014 (UTC)


 * the real DOS supported menus in config.sys, but only at boot time. Selecting an option from the menu would jump to the correspoding section in autoexec.bat. Apart from that there's still the possibility to use a dedicated menu program of which there are (or used to be) myriads, or a /  combo and a bit of programming. The "DOS" window in Windows also supports interactive input like choice, for example set /a x   will set %x% to whatever the user entered Asmrulz (talk) 22:25, 31 July 2014 (UTC)
 * thanks for the help. discovered how to use choice command, how to use errorlevel stuff, the :insertthinghere stuff, echo....., now I just need to find a easy way to mix all those stuff since my game pack has 150+ games.201.78.142.165 (talk) 13:15, 1 August 2014 (UTC)


 * One easy method for command.com or cmd:
 * Make a menu.bat, containing only the echo lines.
 * echo Select the letter you want to go, and press ENTER:
 * echo A - Action games
 * echo B - Board games
 * echo C - Card games
 * echo J - Jump'n'Run games
 * echo Z - [show next letters]
 * echo J - Jump'n'Run games
 * echo Z - [show next letters]


 * Make Z.bat, containing only the echo lines.
 * echo Select the letter you want to go, and press ENTER:
 * echo K - Kart Racing games
 * echo X - 4X games
 * echo Y - [show prev letters]
 * (This batch is run by the user when typing Z.)
 * (This batch is run by the user when typing Z.)


 * Y.bat consists of a single line:
 * menu.bat
 * (You shouldn't need more than two "screens" of letter menus, because this solution can handle more than 10 entries per sub-menu. But if the submenus scroll off-screen, it becomes more tricky.)


 * Then make an A.bat containing only a change dir and some more echo lines.
 * cd A
 * cls
 * echo Select the game you want to play, and press ENTER:
 * echo 1 - (Action game #1)
 * echo 2 - (Action game #2)
 * echo 12 - (Action game #12)
 * echo 0 - back to main menu
 * (This batch is run by the user when typing A.)
 * (This batch is run by the user when typing A.)


 * Make the directory A, and make 1.bat there, for running the game. For example, 1.bat:
 * cd 1
 * action1 Origin
 * cd ..
 * cd ..
 * menu
 * This will run the game action1, in my example with a command line parameter "Origin". ;) After that, it will return to the directory containing menu.bat.


 * Don't forget 0.bat:
 * cd ..
 * cls
 * menu


 * This does come with a side of Ugly if the user screws up:
 * But hey, it's a GOTO-less solution, so it's superior! - ¡Ouch! (hurt me / more pain) 06:35, 4 August 2014 (UTC)
 * But hey, it's a GOTO-less solution, so it's superior! - ¡Ouch! (hurt me / more pain) 06:35, 4 August 2014 (UTC)

EMF files damaged during PDF export in Microsoft Word
I often use EMF images to illustrate technical documents I write in Microsoft Word (since Word doesn't support SVG). But there has always been one major issue: often a single (vector) line in an EMF file is damaged during PDF export (using the built-in PDF export feature of Word 2007+). Here are some examples:

* becomes * becomes * becomes * becomes * becomes * becomes

As you can see, in every EMF image, a single line is severely displaced in the PDF version. Is there some way to resolve this issue? Why does it happen?

If you want to try it yourself, here is one of the original EMF files. Try to insert it as an image in a Microsoft Word document, and export the document to a PDF file. --Andreas Rejbrand (talk) 20:20, 31 July 2014 (UTC)


 * Am I stretching the intention of your "Is there some way to resolve this issue?" by observing that LibreOffice exports the example you provide fine (it also supports SVG properly)? I don't have Word to hand to verify it, but you may find that opening your DOC/DOCX in LibreOffice (or, probably, OpenOffice) and having it render to PDF will produce an adequate result. -- Finlay McWalterᚠTalk 22:23, 31 July 2014 (UTC)


 * Thank you for your suggestion. Although I suspect opening the rather complex DOCX file in LibreOffice would produce a number of new problems (I did try to do such a thing a number of years ago, and it didn't work out well, but perhaps things have improved since then), this gave me a new idea: Maybe I could use LibreOffice to create a PDF document from the EMF image, and then insert the PDF as an OLE object in the Word document?


 * Anyhow, I fixed my current issues by opening the EMF in PowerPoint, converting it to an Office drawing (which introduces the problem), ungrouping the objects, fixing the problem manually, and then saving the objects to a new EMF file, which does not cause any trouble when Word creates the PDF. (Yeah, I did this for all the images. It took me quite some time.) --Andreas Rejbrand (talk) 22:47, 31 July 2014 (UTC)


 * I noticed the "PDF as OLE object" method doesn't work, since the PDF display appears to be raster graphics. Anyhow, I believe I have found a very simple solution to the original problem:


 * Open the EMF file in Microsoft PowerPoint.
 * Right click the image, and select "Save as image...".
 * Save the image as a Windows Metafile (*.wmf) -- **not** an Enhanced Windows Metafile (*.emf).
 * The obtained file can be used without problems in Word -- it will not cause any problems when the document is exported to a PDF file.


 * Andreas Rejbrand (talk) 10:42, 1 August 2014 (UTC)


 * After some additional testing, I can confirm that my proposed solution above works perfectly. It's magic! --Andreas Rejbrand (talk) 20:52, 1 August 2014 (UTC)