Jump to content

HOTAS Warthog load Script at Startup


Recommended Posts

Hi all,

After a few years away from DCS I jumped back in and bought myself a HOTAS Warthog :joystick:

After figuring out the script language to set up some LED functions and get all my keybindings and macros to work I was desperately looking for a way to automatically load that script at startup because I only fly the A10C anyway..

Since I couldn't find any solution online I decided to look further into the manuals and release note and finally found a solution to my problem.

 

This also works if you wanna turn the LEDs off at startup for example, since turning the LEDs off can be implemented in a script.

 

The solution is to launch TARGETGUI.exe with command line parameters asking to run a certain script as follows:

"C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\Users\%USERNAME%\Documents\Thrustmaster Warthog Configurations\DCS A10C Warthog.tmc"

 

Note that your path to TARGETGUI.exe and to the script file may differ.

 

TARGETGUI.exe also supports other command line parameters as depicted in the attached picture below.

 

Another thing I did to keep my desktop clean upon booting is to minimize the window to the task bar using nircmd (http://www.nirsoft.net/utils/nircmd.html - download link at the bottom, instructions here: http://www.instructables.com/id/Great-stuff-with-command-prompt-and-Nircmd/step2/Install-nircmdexe/) with the following command:

"nircmdc.exe" win min process "TARGETGUI.exe"

 

Note that one could also use the following command to completely hide the window and have TARGETGUI.exe run in the background:

"nircmdc.exe" win hide process "TARGETGUI.exe"

The downside of this approach is that there is no access to TARGETGUI.exe and one would need to kill the process to run a different script file for example. This is no problem to me since I only fly the A10C.

 

To wrap it up I wrote a bat file that I call from my windows startup folder:

@echo TARGET Script launched..
@echo 1/2) Calling Script from TARGETGUI..
@Start "" "C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\Users\%USERNAME%\Documents\Thrustmaster Warthog Configurations\DCS A10C Warthog.tmc"
@timeout /t 1
@echo 2/2) Hiding TARGETGUI window to task bar..
@"nircmdc.exe" win min process "TARGETGUI.exe"
@timeout /t 1

 

Hope this little guide comes in handy to some of you !

1283167512_TARGETGUI.execommandlineparameters.PNG.1231f690caa3cb1723e032d5ec3c69cc.PNG


Edited by BlackSharkAce
  • Thanks 1
Link to comment
Share on other sites

...I was desperately looking for a way to automatically load that script at startup because I only fly the A10C anyway.

 

Your script is an interesting approach.

 

But if it's only about loading a script (compiling it has still to be done manually) you can also put a shortlink of the TARGET.exe on your desktop and add the needed tmc in the properties:

 

"C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETScriptEditor.exe" "D:\Games\HOTAS-Files\TARGET\Scripts\Falcon4 BMS.tmc"

 

Now the tmc will directly be loaded if you start TARGET via the desktop-shortcut.

 

And thanks fot the hint to nircmdc. Nice tool!

Link to comment
Share on other sites

  • 1 year later...

This is a little beyond my pay grade...... I would like to just keep the lights off all the

time, and have to go into Target to shut them down every time my pc starts.

 

Others said to turn them off and then just uninstall target, but that did not work for me.

 

I would very much appreciate some help with this problem

 

Thanks

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

i´m totaly new with Target and having problems to get it work to turn off leds from throttle and Cougar MFD´s with script.

 

In Target Script Editor i started a new .tmc file and put in this code (don´t know i its pasted in the correct section):

 

[color=#1e90ff][b]include[/b][/color] [color=#a52a2a]"target.tmh"[/color]

[color=#32cd32]//program startup[/color]
[color=#1e90ff][b]int[/b][/color] main()
{
   [color=#1e90ff][b]if[/b][/color][color=#ffffff]([/color]Init(&EventHandle)) [color=#1e90ff][b]return[/b][/color] [color=#ffffff]1[/color]; [color=#32cd32]// declare the event handler, return on error[/color]
   
   [color=#32cd32]//add initialization code here[/color]
   
   
[color=#32cd32]//initialize Throttle-LED status all "OFF"[/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&Throttle, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED1)); [color=#32cd32]//set LED 1 OFF [/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&Throttle, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED2)); [color=#32cd32]//set LED 2 OFF [/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&Throttle, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED3)); [color=#32cd32]//set LED 3 OFF[/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&Throttle, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED4)); [color=#32cd32]//set LED 4 OFF [/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&Throttle, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED5)); [color=#32cd32]//set LED 5 OFF [/color]

[color=#32cd32]//initialize MFD-LED status all "OFF"[/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&LMFD, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED1)); [color=#32cd32]//set left MFD LED 1 OFF [/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&LMFD, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED2)); [color=#32cd32]//set left MFD LED 2 OFF [/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&RMFD, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED1)); [color=#32cd32]//set right MFD LED 1 OFF [/color]
ActKey[color=#ffffff]([/color]PULSE[color=#ffffff]+[/color]KEYON[color=#ffffff]+[/color]LED(&RMFD, LED_ONOFF, LED_CURRENT[color=#ffffff]-[/color]LED2)); [color=#32cd32]//set right MFD LED 2 OFF    [/color]
}

[color=#32cd32]//event handler[/color]
[color=#1e90ff][b]int[/b][/color] EventHandle[color=#ffffff]([/color][color=#1e90ff][b]int[/b][/color] type, [color=#1e90ff][b]alias[/b][/color] o, [color=#1e90ff][b]int[/b][/color] x)
{
   DefaultMapping(&o, x);
   
   [color=#32cd32]//add event handling code here[/color]
}

After compiling without error message and pressing the "Run" button from Script Editor, nothing happens. Leds are all still on.

 

Where do i have to exactly paste the code? Are there other changes necessary on other files?

 

And could somone please give an example for switching throttles led off with using the throttle-friction-control lever?

 

It must be starting with:

KeyAxis(&Throttle,THR_FC,0,AXMAP2(LIST(0,40,60,100)

but how does it go on in code for switching theese tiny little leds?

 

Have read the Target Script Editor´s manual and copy/pasted some examples but with no success.

ASROCK X79 Extreme11 (WC), i7-4930K (WC), 32GB G.Skill TridentX, Vertex 3 120GB, GTX 980ti, 3x 39,5" Philips 4K, TrackIR 5, TM Warthog with PeterP´s FFB2 Mod, 2xSaitek Throttle, 2x Thrustmaster Cougar MFD Bezel, Simped Vario Pedals modded with toe brakes, Opencockpit Cards, 4x Soundcard, 2x Buttkicker Gamer 2, 4x GTX 950 with tons of touchscreens...

Link to comment
Share on other sites

Hi,

 

I have used LED switching yesterday but not directly with script, GUI only (and I have not checked out the generated script). But I can see that you use PULSE action in your script whereas LEDs only work with PRESS (switch on) and RELEASE (switch off) actions.

 

Hope it helps

Link to comment
Share on other sites

  • 2 years later...
Your script is an interesting approach.

 

But if it's only about loading a script (compiling it has still to be done manually) you can also put a shortlink of the TARGET.exe on your desktop and add the needed tmc in the properties:

 

"C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETScriptEditor.exe" "D:\Games\HOTAS-Files\TARGET\Scripts\Falcon4 BMS.tmc"

 

Now the tmc will directly be loaded if you start TARGET via the desktop-shortcut.

 

And thanks fot the hint to nircmdc. Nice tool!

 

I don't understand how to autoload profile on startup?

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

  • 3 months later...
I don't understand how to autoload profile on startup?

 

Drag the TMC-File to your desktop making it that way a shortcut.

Right click on that icon, go to properties.

"Target": C:\GAMES\HOTAS-Files\TARGET\Scripts\FA-18C.tmc

"Start in": C:\Games\HOTAS-Files\TARGET\Scripts

 

Obviously: Change path, etc. to your needs.

 

Save

 

 

Double click on it and the config shall now open in the editor:

Ready to compile.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
Very old thread, but for anyone dropping in here and want to turn off all the LEDS...

 

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED0));

 

dmonds

 

 

Where do I put that code?

klem

56 RAF 'Firebirds'

ASUS ROG Strix Z390-F mobo, i7 8086A @ 5.0 GHz with Corsair H115i watercooling, Gigabyte 2080Ti GAMING OC 11Gb GPU , 32Gb DDR4 RAM, 500Gb and 256Gb SSD SATA III 6Gb/s + 2TB , Pimax 8k Plus VR, TM Warthog Throttle, TM F18 Grip on Virpil WarBRD base, Windows 10 Home 64bit

Link to comment
Share on other sites

  • 1 year later...
On 6/25/2015 at 6:03 AM, BlackSharkAce said:

Hi all,

After a few years away from DCS I jumped back in and bought myself a HOTAS Warthog :joystick:

After figuring out the script language to set up some LED functions and get all my keybindings and macros to work I was desperately looking for a way to automatically load that script at startup because I only fly the A10C anyway..

Since I couldn't find any solution online I decided to look further into the manuals and release note and finally found a solution to my problem.

 

This also works if you wanna turn the LEDs off at startup for example, since turning the LEDs off can be implemented in a script.

 

The solution is to launch TARGETGUI.exe with command line parameters asking to run a certain script as follows:

 


"C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\Users\%USERNAME%\Documents\Thrustmaster Warthog Configurations\DCS A10C Warthog.tmc"
 

 

 

Note that your path to TARGETGUI.exe and to the script file may differ.

 

TARGETGUI.exe also supports other command line parameters as depicted in the attached picture below.

 

Another thing I did to keep my desktop clean upon booting is to minimize the window to the task bar using nircmd (http://www.nirsoft.net/utils/nircmd.html - download link at the bottom, instructions here: http://www.instructables.com/id/Great-stuff-with-command-prompt-and-Nircmd/step2/Install-nircmdexe/) with the following command:

 


"nircmdc.exe" win min process "TARGETGUI.exe"
 

 

 

Note that one could also use the following command to completely hide the window and have TARGETGUI.exe run in the background:

 


"nircmdc.exe" win hide process "TARGETGUI.exe"
 

 

The downside of this approach is that there is no access to TARGETGUI.exe and one would need to kill the process to run a different script file for example. This is no problem to me since I only fly the A10C.

 

To wrap it up I wrote a bat file that I call from my windows startup folder:

 


@echo TARGET Script launched..
@echo 1/2) Calling Script from TARGETGUI..
@Start "" "C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\Users\%USERNAME%\Documents\Thrustmaster Warthog Configurations\DCS A10C Warthog.tmc"
@timeout /t 1
@echo 2/2) Hiding TARGETGUI window to task bar..
@"nircmdc.exe" win min process "TARGETGUI.exe"
@timeout /t 1
 

 

 

Hope this little guide comes in handy to some of you !

1283167512_TARGETGUI.execommandlineparameters.PNG.1231f690caa3cb1723e032d5ec3c69cc.PNG

 

Thank you! I changed it up a bit because for some reason the virtual controller does not catch on, so I test in Game Control Panel.

 

@echo TARGET Script launched..
@echo 1/3) Calling Script from TARGETGUI..
@Start "" "C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\YourPathHere\NameOfProfile.tmc"
@timeout /t 1
@echo 2/3) Hiding TARGETGUI window to task bar..
@"nircmd.exe" win min process "TARGETGUI.exe"
@timeout /t 1
@echo 3/3) Opening Game Controllers Panel..
@%SystemRoot%\System32\joy.cpl"
@timeout /t 1

 

Link to comment
Share on other sites

Thank you! I changed it up a bit because for some reason the virtual controller does not catch on, so I test in Game Control Panel.

 
@echo TARGET Script launched..@echo 1/3) Calling Script from TARGETGUI..@Start "" "C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\YourPathHere\NameOfProfile.tmc"@timeout /t 1@echo 2/3) Hiding TARGETGUI window to task bar..@"nircmd.exe" win min process "TARGETGUI.exe"@timeout /t 1@echo 3/3) Opening Game Controllers Panel..@%SystemRoot%\System32\joy.cpl"@timeout /t 1

 


Yeah I have the same issue now with the virtual controller and some of the non-virtual controllers staying « active » in the back. How did you solve it ?

I just put a long timer to let everything initialise and then it’s fine, but it needs like 40sec or so after boot to be ready to go.. so I’d be interested if there is a better approach !
Link to comment
Share on other sites

7 hours ago, BlackSharkAce said:


Yeah I have the same issue now with the virtual controller and some of the non-virtual controllers staying « active » in the back. How did you solve it ?

I just put a long timer to let everything initialise and then it’s fine, but it needs like 40sec or so after boot to be ready to go.. so I’d be interested if there is a better approach !

If you are asking me, I have no idea at all of what you are talking about. Pics may help.

Link to comment
Share on other sites

  • 3 months later...

is there no command option to run and compile a .tmc using the ScriptEditor?

 

btw. everyone wanting to use autostart:

You are more flexible using the Windows TASK SCHEDULER. You can run tasks delayed or using various triggers and, most important, running things with Admin-rights as well (like PiTool f.e.)

Thrustmaster Warthog HOTAS + Pedals

(AB-detent Mod, Stick extension Mod)

HTC Cosmos VR

Track IR

----------

Intel i9-9900K

64GB Ram

GeForce RTX 2080 Ti

Link to comment
Share on other sites

12 minutes ago, HorNet505 said:

is there no command option to run and compile a .tmc using the ScriptEditor?

 

btw. everyone wanting to use autostart:

You are more flexible using the Windows TASK SCHEDULER. You can run tasks delayed or using various triggers and, most important, running things with Admin-rights as well (like PiTool f.e.)

If you are asking what I think you are asking , the command is
`C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\YourPathHere\NameOfProfile.tmc`

Link to comment
Share on other sites

On 2/14/2021 at 2:32 AM, BlackSharkAce said:


Yeah I have the same issue now with the virtual controller and some of the non-virtual controllers staying « active » in the back. How did you solve it ?

I just put a long timer to let everything initialise and then it’s fine, but it needs like 40sec or so after boot to be ready to go.. so I’d be interested if there is a better approach !

Ooooooh. I see what meant by that. I have changed my script to a 20 second timer and removed a few lines so that it now effectively looks like this. Previously it took a few tries to get the profile to fully load. Now it is working on first try. Fingers crossed that this works every time. I'll also try my hand at the windows scheduler later too.
 

@echo TARGET Script launched..
@echo 1/3) Calling Script from TARGETGUI..
@Start "" "C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "C:\YourPathHere\NameOfProfile.tmc"
@timeout /t 20
@echo 3/3) Opening Game Controllers Panel..
@%SystemRoot%\System32\joy.cpl"
@timeout /t 1

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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