GoXLR app hide screen on Windows startup

Since some time now I have the GoXLR mini which is a wonderful device. However, the one thing I don't like is that I am presented with the configuration screen at each Windows startup. A tweet for another GoXLR user triggered an idea which allows to hide the screen without support in the current software.

If you're just here for the good stuff, go here and use it on your system: https://github.com/jfversluis/HideGoXLRWindow. For others, I'll explain a bit more what it does.

GoXLR App Startup

The "problem" is that each time you start Windows you get to see a screen similar to below. While a lot of applications have an option to not show at startup or start minimized, the GoXLR app does not.

GoXLR App user interface screenshot
GoXLR App

I mean, it's not a big issue to just close it, but still it makes no sense to have to see it each time. And to make it even more painful, the application will also ask if you want to minimize the screen or really close it.

The Power of PowerShell

So for work I have been doing some PowerShell and to be perfectly honest, this script comes from my great team member Anže. But first, let's see what triggered it. It was the tweet below by Immo that made me put the pieces together.

Immo tweets at TC Helicon, the company behind GoXLR, if there is something they can do to fix this. This got me thinking; is there something we can do right now? And there is!

The PowerShell Script

If you go to the repo that I put this stuff on, you will mainly find three things: HideGoXLR.ps1, install.bat and HideGoXLR_startup.cmd. The latter two are there to install the files in the right places and run the actual script on startup. All of this just text so you can inspect them to see no funny business is going on 😀

The real magic happens in the ps1 (PowerShell) file. This is shown below.

param(
[Parameter()]
[Int32]$attempts = 3,
[Parameter()]
[Int32]$sleep = 10,
[Parameter()]
[bool]$keepAlive = $false
)
try {
$Win32ShowWindowAsync = Add-Type -MemberDefinition @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"@ -name "Win32ShowWindowAsync" -Namespace Win32Functions -PassThru
} catch {}
Write-Output "Hiding GoXLR Windows...";
while (($attempts -gt 0) -or ($keepAlive -eq $true)) {
# Get All GoXLR Desktop processes and find one with a window handle
(Get-Process -Name "GOXLR APP*").MainWindowHandle | ForEach-Object {
if($_ -eq 0) { return; } # We can ignore processes spun up that have no window
Write-Output "Found a GoXLR Window... Closing it now.";
# We'll Hide the window through its handle
$Win32ShowWindowAsync::ShowWindowAsync($_, 0) | Out-Null
}
Write-Output "Attempts remaining: $attempts, sleeping for $sleep, keep alive: $keepAlive"
if($keepAlive -eq $false) {
$attempts--;
}
Start-Sleep -Seconds $sleep
}
view raw HideGoXLR.ps1 hosted with ❤ by GitHub

So what this basically does is hook into Windows API's, check the running processes, specifically the ones that have a (visible) window. And then, when we find one from GoXLR, we send a message to close it. It will automatically minimize it, so it will keep running, it will just hide the window for us.

The one thing I didn't really fix yet is that you will look at a command terminal for a little while, 30 seconds to be exact. I've tried to make that more precise, but it had some timing issues on startup. So what the script does now is repeat the same thing maximum of 3 times with 10 seconds between each try.

In that time it will look for the process and try to close the window. You can fiddle with the values in the parameters on top a little or find out a way to hide the command window (and let me know!). But the window will disappear automatically, so it's still better than it was.

Because the PowerShell file takes some parameters, you can also start it your own way and just specify the parameters on the command-line. Something like this: .\HideGoXLR.ps1 -attempts 1 -sleep 1. Which will retry only once to find the process and window, it takes a 1 second break.

This can just be ran from any command-line where you can access PowerShell. So if you have something else running, you can hook it up that way.

First World Problem Solved!

Of course this was never a big problem to begin with, I just had some fun with a script we had already laying around and trying out some scripting around that to brush up my skills in that area. But nevertheless, if this bothers you, you can use this and never see that dreaded GoXLR app on startup again!