Jump to content
LaunchBox Community Forums

Shutting Down LB with a Batch File


The Papaw

Recommended Posts

I created a batch file to kill LB, just curious if this is a safe way to do it or will I end up with corrupted files over time.

This is what I am using:

@echo off
taskkill /im LaunchBox.exe

It appears to be working okay with the few tests I've done, including saving the backups.  

If there is a safer way, please do share.

Link to comment
Share on other sites

24 minutes ago, The Papaw said:

I created a batch file to kill LB, just curious if this is a safe way to do it or will I end up with corrupted files over time.

This is what I am using:

@echo off
taskkill /im LaunchBox.exe

It appears to be working okay with the few tests I've done, including saving the backups.  

If there is a safer way, please do share.

Launchbox writes files after you close it via its x on the window. Task killing it i assume id doing just that, unsafely closing launchbox, meaning it cant write files at close, like newly added or edited games for example.

Edited by neil9000
Link to comment
Share on other sites

6 minutes ago, neil9000 said:

Launchbox writes files after you close it via its x on the window. Task killing it i assume id doing just that, unsafely closing launchbox, meaning it cant write files at close, like newly added or edited games for example.

Thanks @neil9000

Here is what I am up too.

My master Launchbox rig is getting pretty large and most themes are really dragging now on the slower PC's around the house. I am thinking about making multiple instances of LB on them, say one for just Arcade, another for the older platforms and maybe another for the more modern platforms, then creating a batch file or maybe some type of Windows app in virtual studio or something to run first, allowing the user to pick the one they want, then when they exit it, take them back to the app or bat file to change to a different one.

Even thought about just creating one instance of LB to run first with only the different instances of LB and let it run the batch files to kill and re-open the different instance???? 

Link to comment
Share on other sites

Sounds like what you want is a "LaunchBox Menu" of sorts.  You run the program, which brings up a 'menu':

  • LaunchBox Arcade
  • LaunchBox Classics
  • LaunchBox Modern
  • Exit

You click one of those LB options.  Then when you exit LB, the menu reappears.

 

The verdict is out regarding TaskKill.  It's definitely bad if you add the /F parameter which will Force Kill the program.  But I can't really find anything saying that running without /F is as safe as:   painstakingly placing your hand on your mouse, sliding it with all-your-might to move the pointer all-the-way up to the upper right corner where the "X" is, and forcing your index finger to push down the left mouse button to "click the X".

I think you'd be best off with a menu type thing.  That can be made using a batch file, AHK script or Visual Studio.

Link to comment
Share on other sites

10 minutes ago, JoeViking245 said:

Sounds like what you want is a "LaunchBox Menu" of sorts.  You run the program, which brings up a 'menu':

  • LaunchBox Arcade
  • LaunchBox Classics
  • LaunchBox Modern
  • Exit

You click one of those LB options.  Then when you exit LB, the menu reappears.

 

The verdict is out regarding TaskKill.  It's definitely bad if you add the /F parameter which will Force Kill the program.  But I can't really find anything saying that running without /F is as safe as:   painstakingly placing your hand on your mouse, sliding it with all-your-might to move the pointer all-the-way up to the upper right corner where the "X" is, and forcing your index finger to push down the left mouse button to "click the X".

I think you'd be best off with a menu type thing.  That can be made using a batch file, AHK script or Visual Studio.

Yes Sir, that is exactly what I am gonna be trying to do. I don't see a reason to use the /f switch as it LB appears to be closing well (at least with v12.12, I know these things may change with updates sometimes)

Something I am not sure about is when LB/BB is opened, then closed, then re-opened again, it tends to run a bit slower if the PC isn't re-booted for some reason. Like maybe memory isn't cleared 100% from the previous run or something. Could be a windows thing, I really don't know.

I think I can pull it off with bat or AHK

I was wondering if something in Visual Studio or even something else might work and look better if you create it with a cool icon and make it an exe or something? Rather than having 5-10 script files. But never done anything with VS before. I assume you would use some type of invoke in it??

Link to comment
Share on other sites

With a batch or ahk, you'll only need ever one (script) file.  VS (once compiled) will be only 1 file.  As far as files being an exe, you can convert ahk to exe, and .bat to .com (I think. It's been a while), .cmd or even convert it to a PowerShell file.  Speaking of which, PowerShell is another language you can look into.  But there's really no need to shoot for a specific executable file type.  Create a shortcut to your completed file and you're done.

39 minutes ago, The Papaw said:

I was wondering if something in Visual Studio or even something else might work and look better

Rhetorical question? ;) 

 

A batch file can be somewhat generic  (Sample here)

image.png.03a261e7b77b964020eeb4aa79db7124.png

Or a little more elaborate  (Sample here) [can probably add icon/images somehow as well]

image.thumb.png.8dadcc463d1bdd5038010af6665b3cf7.png

AHK of course can do this as well.  (a very generic "game menu")

But it will all depend on your comfort level with either one of these and your ability to research.

 

Visual Studio has a learning curve of its own.  But again, if you can do a google search, you can find out how to do what you're wanting.  Though you may need a little ingenuity and a lot of patience.  But the answers are all out there.

image.png.6154522d2820e0f5c1c543fe061ac486.png

2 versions of LB. Mess emu (ol' school).  MAME emu.  Also includes links to their respective folders plus 4 others.

Link to comment
Share on other sites

On 5/21/2022 at 11:50 AM, JoeViking245 said:

With a batch or ahk, you'll only need ever one (script) file.  VS (once compiled) will be only 1 file.  As far as files being an exe, you can convert ahk to exe, and .bat to .com (I think. It's been a while), .cmd or even convert it to a PowerShell file.  Speaking of which, PowerShell is another language you can look into.  But there's really no need to shoot for a specific executable file type.  Create a shortcut to your completed file and you're done.

Rhetorical question? ;) 

AHK of course can do this as well.  (a very generic "game menu")

 

 

respective folders plus 4 others.

I've gotten busy and just getting back to playing with this. Been tinkering with AHK a bit this morning.

Looking for a way to add an image to each menu now if you can, never tried before

Link to comment
Share on other sites

46 minutes ago, The Papaw said:

Looking for a way to add an image to each menu now

I never tried before in AHK either. ;) This should get you started.  "ahk add image to menu gui" 

image.thumb.png.40cfcb7a3eb8123e8fe64c620a7e1f04.png

When you test the guys script with your own .bmp image, you may need to change line #14.  (remove the plus ( + ) symbol)

;before
Gui, Show, +Hide, Menu Bitmaps

;after
Gui, Show, Hide, Menu Bitmaps 

 

Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

I never tried before in AHK either. ;) This should get you started.  "ahk add image to menu gui" 

image.thumb.png.40cfcb7a3eb8123e8fe64c620a7e1f04.png

When you test the guys script with your own .bmp image, you may need to change line #14.  (remove the plus ( + ) symbol)

I got some png's working in it, now I am trying to figure out how to make them clickable, something to do with a "A g-label such as gMySubroutine may be listed in the control's options. This would cause the MySubroutine label to be launched automatically whenever the user clicks the picture.". -quoted  from autohotkey.com

Just getting things going, and I will probably find different images and maybe change layout, maybe  2 x 2 square instead of single line, maybe get rid of the buttons once I figure out how to make the images clickable????:ph34r:

Here is what I got so far:

Untitled.thumb.jpg.9bed44f9cf7101b42166e39ab50d8a20.jpg

Edited by The Papaw
Link to comment
Share on other sites

1 hour ago, The Papaw said:

SmartGUI

I've used that before. It's a little weird at very 1st to figure what you're doing. But then seems ok.  The last suggested search I gave, 1st hit shows pretty easily how to have a clickable image.  Can even set it up to distinguish between Left, Middle and Right clicks.

  • Like 1
Link to comment
Share on other sites

Here is want I wound up with (still tweaking).

I had no idea you could do so much as easily as you can with AHK. Definitely will be using much more in the future. Thanks again Joe for the support

The Menu:

1896726398_Menu1.thumb.png.e83fc37c5de422c249771d29b8bb710c.png

Showing a confirmation prompt:

913898745_Menu2.thumb.png.7ec66ca76badc16372bc2e93e96c4b72.png

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...