Jump to content

Auto switch Joystick Gremlin profile from Stream Deck


scoobie

Recommended Posts

Hi, folks!
This is going to be a little bit tiresome, so see if you meet the "conditions" listed below. If you do, you MAY be interested. If not, don't bother reading, you don't need the thing described below.

1. You have a Stream Deck ("SD" hereinafter) or especially multiple SD's, and you also use Joystick Gremlin ("JG" hereinafter).
2. You have many many SD profiles and many many JG profiles for all you precious DCS modules.
3. Every time you switch profile on a SD to the aircraft currently selected in DCS, you Alt-Tab, bring up JG, File->Open, select profile for this aricraft, "Enable Profile".
4. You're sick and tired of doing the JG part every time you pick a different aircraft.
5. You are computer-literate at the level "3 of 10" or higher.

OK, this was exactly my case, so I thought I would finally beat JG into submission. No programming required, except for a bit of Windows scripting foolishness.

!!! PROCEED AT YOUR OWN RISK !!!

Windows scripting may rip off your fringe or blow up your house, no one knows.

Your "main DCS profile" on SD may look something like this:

sd_main_screen.PNG

Each of those colourful buttons MAY be a "subfolder" if you only have 1 SD, but it may be a "Multi Action" container, or it will surely be a Multi Action if you have many SD's. It's this thing:


multi_action.PNG


The Multi Action is virtually inevitable for multiple SD's because SD software does not allow a single profile be "shared" across multiple SD's. Each SD has to have a separate profile only for itself, so... if you want your, say, 3 SD's to switch to "Tomcat profile", you need to switch on "Tomcat profile for SD no. 1" on SD no. 1, "Tomcat profile for SD no.2" on SD no. 2 etc. Hence you use "Multi Action" to do all that with a single button press. For example, one of my Multi Actions hidden behind those pretty icons (in the first screenshot above) looks like this:


tomcats_multi_action.PNG


I have 3 SD's, so I need to switch profile in each - hence the 3 "Navigation: Switch Profile" commands. I'm not showing their details here.

If you have your profile arranged this or similar way, you can relatively easily make your JG (Joystick Gremlin) switch to its own profile for a particular aircraft via an additional command in this very Multi Action container.

For this you need 2 things:
1. Add "System" "Open" control from the SD menu to the list of actions in the Multi Action container. We will make it launch a batch file.
2. The batch file that will do the magic. More on it later.

Ad 1. "System: Open" item.

It's this:
system_open.png


Once you add it to the list of actions, you will have to specify the command for it. In my case it looks like this (example for the Tomcat):

tomcats_system_open.png

The command syntax is crucial. Mine reads this:

cmd.exe /c "E:\musthave\gremlin_profiles\!RUN_PROFILE.bat" f-14

The "cmd.exe /c " part is mandatory. It runs that black "command prompt" or "DOS" window and inside it runs the specified batch file. Next you specify the path for the batch file, enclosed in double quote marks. Then the name of your JG profile for this aircraft, just deprive it of ".xml" part. My profile's file name for the Tomcat is "f-14.xml", so I wrote only the "f-14" part in the command above.

Ad 2. The batch file.
First of all, I'm not a Windows scripting magician, so my file is crude, messy, and probably very silly, I barely understand what the heck I'm doing. If you're a better Windows script man, you'll probably want to refine it to your liking. If you're not, you will still need to change the path for JG itself and the directory where you keep your JG profiles. It is assumed you keep them all in one common folder.
Here's the contents of the batch file for reference (I also attached the file to this post).
 

@echo off
rem SET DIRECTORY WHERE YOU KEEP ALL YOUR GREMLIN PROFILES:
set profile_dir=E:\musthave\gremlin_profiles

rem Below "Ctrl-G" character at the end of a few strings for "echo" is the "BEL" ASCII char.
rem Use a proper text editor to see it (Notepad is not one).
rem Such char nowadays makes Windows play one of the "system sound"/jingle (tested on Win10 x64 in 2024).
rem I use it as an aural warning to the user.

if "%1"=="" (
echo Specify Gremlin's profile name without ".xml" as an argument to this batch script.
echo Example: to run profile "F-16.xml" type: !RUN_PROFILE.bat F-16
pause
exit /b
)

if not exist %profile_dir%\%1.xml (
echo Profile "%profile_dir%\%1.xml" not found.
pause
exit /b
)

tasklist /FI "IMAGENAME eq joystick_gremlin.exe" 2>NUL | find /I /N "joystick_gremlin.exe">NUL
if "%ERRORLEVEL%"=="0" (
echo Killing current instance of Joystick Gremlin...
taskkill /F /IM joystick_gremlin.exe >nul 2>&1
if "%ERRORLEVEL%" neq "0" (
echo taskkill on joystick_gremlin.exe has failed, exitting!
pause
exit /b
)
)

echo Starting Gremlin with %1.xml profile...
start "" /D D:\Gremlin "joystick_gremlin.exe" --enable --profile %profile_dir%\%1.xml

What the batch file does is this:
A. It checks if an argument was given. If not - error/sound/stop.
B. Checks if the file given as an argument (automatically appended with ".xml") exists. If not - error/sound/stop.
C. Checks if JG is currently running. If it is, the script will try to kill the process. If this fails - error/sound/stop.
D. Starts JG with the profile given to the script as the argument and automatically enables the profile.

Remember you need to set your folders in the script:
- "profile_dir" - a common directory for all JG profiles (mine is "E:\musthave\gremlin_profiles"),
- JG directory in the last line of the script (mine is "D:\Gremlin").

If you have spaces in your paths, some more tinkering may be required in the file. Maybe double quotes here and there, I don't know. I find Windows scripting messy, never felt like learning it properly.

The block of "rem" commands near the top of the script describes how I achieved the "windows system sound" playing when the script failed. I hope the explanation there is sufficient. It's just a little gimmick. If the batch file succeeds, you will hear nothing and you may only see a very brief "task switch" from DCS to Desktop and back to DCS within a fraction of a second. If something goes wrong, however, you will hear that windows "jingle" to warn you, Windows will switch from DCS to the command prompt window with the batch file open, showing what went wrong.

If it works for one of your aircraft, you may now copy-paste that "System: Open" command from one Multi Action to all the others, every time changing the last part - the argument with JG profile file name. Takes a few minutes for 40 modules 🙂

Remember the batch file is run only when you trigger your Multi Action with that "System: Open", so, for example, when you only launch DCS and do NOT change the aicraft, your SD opens with the last aircraft (profile) you were using previously, nothing is going to launch JG for you. This means you must run it manually beforehand. Instead you may press one of your "Multi Actions" only to have JG launched, then "Multi Action" back to the aircraft you will actually fly.

 

!RUN_PROFILE.bat

  • Thanks 1

i7-8700K 32GB 2060(6GB) 27"@1080p TM Hawg HOTAS TPR TIR5 SD-XL 2xSD+ HC Bravo button/pot box

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 3/29/2024 at 9:07 AM, Lt_Jaeger said:

Thank you. I adapted this so the Rhino Telem will load different Joystick Gremlin profiles depending on the plane I use

I'm interested in doing something like this. Do you mind sharing how you went about getting the vpforce rhino software to load a joystick gremlin profile? Any information you can give would be appreciated.

Link to comment
Share on other sites

16 hours ago, toffy said:

Any information you can give would be appreciated.

 

 

I currently don't have much time, so onlya short explanation

 

I call a batch file in "Rhino Telemetry". Something like that...

image.png

TheGremlin_F14.bat batch file looks like this. The most important part is, that DCS gets back to focus. Could not manage a direct call of the next batch from Telem yet. Like I said, currently I don't have enough time to experiment and my "batch file knowledge" is very rusty at best.

 

Which calls the batch in the Gremlin User Folder !RUN_PROFILE.bat , taken from OP above.

 

For most of the planes I got a "Kill Gremlin file" which will stop Gremlin and some just load a default gremlin. So basically you can do whatever you want.

 

I have basically a bunch of batch files starting my games to get a configuration I need. IL2 for example looks like crap in VR if I don't set back a couple of Pimax settings first. It all stinks, because it is definitely not plug & play.

 

If you got more questions, shoot me a message, I will reply as soon as I find some time.

 

 


Edited by Lt_Jaeger
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...