grki Posted November 28, 2022 Share Posted November 28, 2022 (edited) 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: 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 ... Edited December 2, 2022 by grki Added "[solved]" to the title ... Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted November 28, 2022 Share Posted November 28, 2022 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 } 1 Quote Link to comment Share on other sites More sharing options...
grki Posted December 2, 2022 Author Share Posted December 2, 2022 Sorry for my late reply. It had a very busy week ... Your approach is different than I had imagined. I can handle with this way too. Thanks a lot! 👍 I will try this out and let you know if and how it worked ... 1 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted December 2, 2022 Share Posted December 2, 2022 Another approach that's a little less 'hacky' (and possibly a little more stable/reliable) is to create an AHK script and use that as your emulator. This way you can use %1% to get the "FULL\PATH\TO\ROM\FILE". (actually it may be %4% because of the other parameters) Just throwing out options. Quote Link to comment Share on other sites More sharing options...
grki Posted December 2, 2022 Author Share Posted December 2, 2022 (edited) 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 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: 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 December 2, 2022 by grki Formating AHS Code 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.