Jump to content
LaunchBox Community Forums

VBS Issue hiding Window


latin625

Recommended Posts

Hi,
I have this vbs script below that hides the cmd window when loading from LB or BB, but it stops LEDBlinky from keeping the button light on.

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "lair.bat" & Chr(34), 0
Set WshShell = Nothing

When I dont use the script and go with a bat file, I lose focus of the game screen and have to click on the mouse to get it focused again.

Any ideas on how to get this to work?

Thanks

 

Link to comment
Share on other sites

Solved.  In case anyone needs to hide CMD but keep focus on emulator.  I used hypseus.exe (The program to return to focus on) as the sample below:

Set WshShell = CreateObject("WScript.Shell")
Dim ObjShell :Set ObjShell = CreateObject("Wscript.Shell")
WshShell.Run chr(34) & "lair.bat" & Chr(34), 0
ObjShell.AppActivate("hypseus")

 

  • Thanks 1
Link to comment
Share on other sites

I'm just in the process of redoing all my Hypseus and Singe2 games, so haven't tested everything with LEDBlinky and focus issues yet, but a few questions/suggestions:

  1. You seem to create 2 Wscript.Shell objects in the first 2 lines, is that needed?
  2. Instead of calling your command BAT file can you not call hypseus directly eliminating the extra process?

Something like this:

Quote

Dim oShell : Set oShell = CreateObject ("Wscript.Shell") 
oShell.Run "cmd /c hypseus.exe lair vldp -framefile framefile\lair.txt -fullscreen -blank_searches -min_seek_delay 1000 -seek_frames_per_ms 20 -fastboot -bank 0 11001000 -bank 1 00100011 -latency 950", 1, true

FYI, I haven't fully test this yet as long as LB calls LedBlinky before starting Hypseus this should work. (If not might have to modify)

Link to comment
Share on other sites

If you only need to hide the command window that comes up when running a batch file, you could (as an option)

  • create a shortcut to the batch file
  • right click the shortcut and select Properties
  • Next to the Run option, select Minimized
  • Click OK to save and close

Now run (point to) the shortcut instead of the batch file itself.

Link to comment
Share on other sites

@Headrush69

Unfortunately, I have super limited skills with this and "ugly fixed" the issue.  Wouldn't know enough to be able to tell you if it is required, but I can say it works 100%.  If you want to streamline it, please have at it.  Would love to have something correct and efficient if it is possible.  Apologies in advance.

Link to comment
Share on other sites

This is what I currently have and no window pop up and LEDBlinky controls stay lite:

Quote

Set oShell = CreateObject ("Wscript.Shell") 
Dim strArgs
strArgs = "cmd /c hypseus.exe lair vldp -framefile framefile\lair.txt -fullscreen -blank_searches -min_seek_delay 1000  -bank 0 11001000 -bank 1 00100011 -seek_frames_per_ms 20 -fastboot -latency 175"
oShell.Run strArgs, 0, true

oShell.AppActivate("hypseus")

The true argument tells the script to wait until the command run ends, so LEDBlinky remains lite.

Edited by Headrush69
Added extra AppActivate for people having issues
  • Unusual Gem 1
Link to comment
Share on other sites

  • 4 months later...
On 1/18/2023 at 6:39 PM, Headrush69 said:

This is what I currently have and no window pop up and LEDBlinky controls stay lite:

The true argument tells the script to wait until the command run ends, so LEDBlinky remains lite.

I am having the same issue where I cant minimize the CMD window and lose focus on the emulator. Where do I put this code? In the batch file or somewhere in LB?

Link to comment
Share on other sites

7 hours ago, MydknyteStyrm said:

I am having the same issue where I cant minimize the CMD window and lose focus on the emulator. Where do I put this code? In the batch file or somewhere in LB?

Is the hide command window option enabled in LB?

I have these commands in a *.vbs file and call it directly from LB. not using using emulation part of LB.

If you are still having issues, hypseus includes a windows subsystem version that doesn't open a command window as well. You can just rename it to hypseus,exe and try that version as well.

Link to comment
Share on other sites

3 hours ago, Headrush69 said:

Is the hide command window option enabled in LB?

I have these commands in a *.vbs file and call it directly from LB. not using using emulation part of LB.

If you are still having issues, hypseus includes a windows subsystem version that doesn't open a command window as well. You can just rename it to hypseus,exe and try that version as well.

I couldn’t find the option to Hide command window in LB. 

how do I implement a vbs file? is it something I run as an additional app in the emulator setting? Sorry for the handholding, I’m currently transferring over from Hyperspin (past due time lol) 

in the VBS file do I put the code that I currently have for my batch file in the quotations as well?

Link to comment
Share on other sites

7 hours ago, MydknyteStyrm said:

I couldn’t find the option to Hide command window in LB. 

Sorry I was away from computer. The Hide command window is only when using emulation mode and under the Emulator details screen.

The VBS method is the same as using a BAT file. Your commands are in that file and you add that file as the launch option and turn off Use Emiulation.

Here is an example of what is in my start_dlair.vbs file:

Quote

Set oShell = CreateObject ("Wscript.Shell") 
Dim strArgs
strArgs = "cmd /c hypseus.exe singe vldp -framefile singe\dle\dle.txt -script singe\dle\dle.singe -fullscreen -min_seek_delay 200 -seek_frames_per_ms 20 -bezel lair.png -blend_sprites"
oShell.Run strArgs, 0, false
OShell.AppActivate("hypseus")

Also make sure to get the windows subsystem version of Hypseus.exe.

Link to comment
Share on other sites

Got it to work beautifully. Thanks! 
Last question. And it’s optional. On my Singe Lightgun games, in the batch file were two other commands starting with REM. I got them from the preset batch files download. 
 

if I include them in the code, on the same line, or in a page break, but always inside the quotes, I throw an error. 
 

I haven’t tried putting them outside the quote of the argument, but wondered if you were able to implement this aS well. The game runs fine without it. It’s just a nocrosshair option. 
 

Thanks again for all your help!

Link to comment
Share on other sites

8 hours ago, MydknyteStyrm said:

Got it to work beautifully. Thanks! 
Last question. And it’s optional. On my Singe Lightgun games, in the batch file were two other commands starting with REM. I got them from the preset batch files download. 
 

if I include them in the code, on the same line, or in a page break, but always inside the quotes, I throw an error. 
 

I haven’t tried putting them outside the quote of the argument, but wondered if you were able to implement this aS well. The game runs fine without it. It’s just a nocrosshair option. 
 

Thanks again for all your help!

Can you post the script you are trying to use?

Placing them in the quotes should work. Sometimes in some editors while working, extra hidden line feeds seem to get added. In those case I delete any spaces where it wraps and re-add a space to make sure that's it's a single line.

On some editors you can turn on showing invisible characters.

If you can post your script and the error, that is the best bet to solving your issue.

Link to comment
Share on other sites

  • 1 month later...
On 1/18/2023 at 12:26 PM, latin625 said:

Solved.  In case anyone needs to hide CMD but keep focus on emulator.  I used hypseus.exe (The program to return to focus on) as the sample below:

Set WshShell = CreateObject("WScript.Shell")
Dim ObjShell :Set ObjShell = CreateObject("Wscript.Shell")
WshShell.Run chr(34) & "lair.bat" & Chr(34), 0
ObjShell.AppActivate("hypseus")

 

Thanks a lot for sharing this vbs script! It really helped me a lot with hypseus-singe, which I was setting up and (finally) got running today :)

  • Game On 1
Link to comment
Share on other sites

  • 1 month later...

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...