How to Run Medal.tv Only While Gaming

Posted 27 days ago by Dennis

Ask a question
Un Answered
D
Dennis

This guide will help you set up Medal.tv to run automatically only when you're playing games, saving system resources when you're not gaming.


Step 1: Create a Directory

Create a new directory in a location you won't accidentally delete. For example:

Documents\MedalOnlyWhileGame


Step 2: Create VBScript File

Open Notepad and paste the following code:


Set objShell = CreateObject("Wscript.Shell")

Set args = Wscript.Arguments

Set fso = CreateObject("Scripting.FileSystemObject")


For Each arg In args

    Dim RunCommand

    Dim PsPath

    

    If LCase(fso.GetExtensionName(arg)) = "ps1" Then

        If fso.FileExists("C:\Program Files\PowerShell\7\pwsh.exe") Then

            PsPath = """C:\Program Files\PowerShell\7\pwsh.exe"""

        ElseIf fso.FileExists("C:\Program Files\PowerShell\7-preview\pwsh.exe") Then

            PsPath = """C:\Program Files\PowerShell\7-preview\pwsh.exe"""

        ElseIf fso.FileExists("C:\Program Files\PowerShell\6\pwsh.exe") Then

            PsPath = """C:\Program Files\PowerShell\6\pwsh.exe"""

        Else

            PsPath = """C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"""

        End If

        RunCommand = PsPath & " -WindowStyle hidden -ExecutionPolicy bypass -NonInteractive -File " & arg

        objShell.Run RunCommand, 0, False

    End If

Next


Save this file as "MedalOnlyWhileGame.vbs" in the directory you created.


Step 3: Create PowerShell Script

Open Notepad and paste the following code:


$gamePaths = @(

    'C:\Program Files (x86)\Steam\steamapps\common\*',

    '!!! PATH 2 !!!',

    '!!! PATH 3 !!!',

    '!!! PATH 4 !!!'

)


$gameRunning = Get-Process | Where-Object { 

    $process = $_

    $gamePaths | Where-Object { $process.Path -like $_ }

}


if ($gameRunning) {

    if (-not (Get-Process "Medal" -ErrorAction SilentlyContinue)) {

        Start-Process "!!! PATH TO MEDAL.EXE !!!" -WindowStyle Hidden

    }

} else {

    Stop-Process -Name "Medal" -Force -ErrorAction SilentlyContinue

}


Replace the placeholders:

Replace !!! PATH 2 !!!, !!! PATH 3 !!!, and !!! PATH 4 !!! with additional game installation paths if needed.

Replace !!! PATH TO MEDAL.EXE !!! with the actual path to Medal.exe on your system.


Save this file as "MedalOnlyWhileGame.ps1" in the same directory.


Step 4: Create a Scheduled Task



For arguments you just need to paste the full path to the vbs and ps1 script for example: "C:\Users\!!! YOUR USER !!!\Documents\MedalOnlyWhileGame\MedalOnlyWhileGame.vbs" "C:\Users\!!! YOUR USER !!!\Documents\MedalOnlyWhileGame\MedalOnlyWhileGame.ps1"


Step 5: Disable Autostart in Medal Settings


Step 6: Restart Your Computer


After completing all steps, restart your computer. Medal.tv will now only run when you're playing games, conserving system resources when you're not gaming.

0 Votes


0 Comments

Login to post a comment