Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'sasachan was here to look for headpat. find her and give, please. -^,..,^-
- askMultiClient = true 'set to true will always force new test client to join instance of already running vrchat.
- closePrevInstance = true 'set to true to close all open instances of VRChat before launching (ignored if forceMultiClient true)
- disableVR = true 'set to true to ALWAYS launch tests in desktop mode
- askNoVR = false 'set to false to bypass asking for no-vr mode (ignored if disableVR is true)
- numClients = 1 'default number of clients to start'
- maxClients = 5 'maximum number of clients to start. keep small unless you hate computer'
- 'On some systems, current working directory points to wrong location. This uses script locale
- launchPath = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName))) & "VRChat.exe"
- Set WMISvc = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
- Set processList = WMISvc.ExecQuery( "Select * from Win32_Process Where Name = 'VRChat.exe'")
- Dim args
- 'Search for and close all open instances of VRChat.exe. Manually closing would be better, but you are busy person, yes?
- 'auto close ignored if forceMultiClient is enabled.
- if closePrevInstance then
- for each process in processList
- if InStr(process.CommandLine, "BuildAndRun") then
- process.Terminate()
- end if
- next
- end if
- 'prompt to choose number of clients to open'
- if askMultiClient then
- inputVal = InputBox( "How many VRChat windows to open?" & vbCrLf & "Number of 1 to " & maxClients & " please.")
- if IsNumeric( inputVal ) then
- inputVal = CInt( inputVal ) 'type adherence? what is?'
- if inputVal >= 1 and inputStr <= maxClients then
- numClients = inputVal
- elseif inputVal = 0 then
- WScript.Quit 0
- end if
- end if
- end if
- 'Prompt to or automatically prepend the launch parameters from the SDK with --no-vr if specified in options
- if IsEmpty(args) then
- args = WScript.Arguments(0)
- end if
- if disableVR then
- args = " --no-vr " & args
- elseif askNoVR then
- result = MsgBox("Launch in no-VR (desktop) mode?" & vbCrLf & "Yes (desktop) No (vr)", vbYesNoCancel)
- Select Case result
- Case vbYes
- args = "--no-vr " & args
- Case vbCancel
- WScript.Quit 0
- end Select
- end if
- 'Test with shell app command, may cause issue with auto task kill
- 'Call CreateObject("Shell.Application").ShellExecute (launchPath, args, "", "open", 1)
- 'Original method, may have issue with permission denied on some system'
- 'script handle open multiple client. sdk managed cause separate script instance which and timing or parent task may be issue or desync'
- for i = 1 to numClients
- 'WScript.Shell limit 1 instance at any moment. shell.application allow multiple'
- Call CreateObject("Shell.Application").ShellExecute (launchPath, args, "", "open", 1)
- Next
- 'Test with exec and not run. may still trigger permission denied'
- 'Call CreateObject("WScript.Shell").Exec ( Chr(34) & launchPath & Chr(34) + args)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement