Jump to content
LaunchBox Community Forums

ROM File Path in AHK Script


grki

Recommended Posts

Does anybody know how I can find out the full path of ROM file for Running or Exit Scripts?

My intention is to run "vmrun.exe" - where I can pass the full path of the rom file - in my case this is a VMX file:

373273016_ScreenshotExitScript-01.thumb.jpg.7adee6147068377da55f9f8f09792a54.jpg

I am reading about the variable "%1%" in many threads here, but this seems only work, when I use a separate AHK script. But I don't want mess my LaunchBox with additional AHK scripts. If possible - I would like make use of the onboard possibilities of LauchBoxs "Running Script" and "Exit Script" freature ...

 

1399228652_ScreenshotGameLaunching-01.thumb.jpg.38d5fea0d78f4c76206f6f5b7a0f4db1.jpg

 

732019232_ScreenshotEmulatorDetails-01.thumb.jpg.4181f84fe69b6716d991a44c81a64789.jpg


 

Edited by grki
Added "[solved]" to the title ...
Link to comment
Share on other sites

1 hour ago, grki said:

Does anybody know how I can find out the full path of ROM file for Running or Exit Scripts?

First, note that the Exit Script is only for when exiting from the Pause menu.

As you've discovered, you can't pass a variable to a Running Script, an Exit Script nor an Additional App.  But you can get creative and find them.

To get the "FULL\PATH\TO\ROM\FILE" from inside a Running Script, you can follow this example.  In this post, it gets the variables passed to "hoxs64,exe".  Change that to "vmware.exe".

 

After that part, you'll need to add an overriding escape sequence so you can run the vmrun.exe sequence. Making use of the appropriate variable you extracted.  Something along the lines of:

$Esc::
{
   RunWait, "C:\Program Files (x86)\VMware Workstation\vmrun.exe" stop "%theVariableYouExtracted%",,Hide
   Run, "C:\Program Files (x86)\VMware Workstation\vmrun.exe" reverToSnapshot "%theVariableYouExtracted%" LaunchBox,,Hide

   WinClose, ahk_exe vmware.exe
}

 

  • Thanks 1
Link to comment
Share on other sites

Okay I got it working! 

Here is my code:

VmRunExecutable = "C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"

queryEnum2 := ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where caption='vmware.exe'")._NewEnum()[process]

CommandLine = % process.commandline

StringSplit, CommandLineParameters, CommandLine, "

VmxFile = %CommandLineParameters4%

RunWait, %VmRunExecutable% stop "%VmxFile%", , Hide
RunWait, %VmRunExecutable% revertToSnapshot "%VmxFile%" LaunchBox, , Hide

1472103195_Screenshot-ExitScript.thumb.jpg.11ffa82f64bdc5f2d1e0b2b8c009c6fc.jpg

 

In my setup I do not use the "$ESC::" event. And I also don't have to run "WinClose, ahk_exe vmware.exe" to quit/end "vmware.exe".
For this to work, the following options must be set in the settings of the VM instance:

251004610_Screenshot-WMware-Options.thumb.jpg.9cfe9d3e6bafe98c15590f68b846667d.jpg

In this way if you exit via LaunchBox Pause Menu - then VMware Workstation does exit automatically after a virtual machine instance has stopped.

 

Thanks again for your input @JoeViking245 - your approach helped me to continue my LaunchBox powered Emulation PC setup! 👍
Now I am able to launch my "Retro OS Collection" (=as VMware Virtual Machines) via LaunchBox resp. BigBox 🎮🕹️😎

Edited by grki
Formating AHS Code
  • Game On 1
Link to comment
Share on other sites

  • grki changed the title to [solved] ROM File Path in AHK Script
  • JoeViking245 changed the title to ROM File Path in AHK Script

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