Yes. You can run TARGET .tmc scripts directly using TARGETGUI.exe. I mean running it using a CMD prompt such as the following:
TARGETGUI.exe -r Myscript.tmc
or using full path names: (for files in their default locations. %USERNAME% will default to your user name)
"c:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r c:\Users\%USERNAME%\AppData\Roaming\Thrustmaster\TARGET\Scripts\Myscript.tmc
You can see a list of the command line options for TARGETGUI.exe by typing the following in a CMD prompt:
"c:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI" -help
Note, quotes above are because of spaces in the path names.
Yes, TARGETGUI.exe is the GUI version of TARGET, but if you use the -r option on a command line, it bypasses the GUI part and immediately compiles and runs the script. The GUI compiler window pops up and runs the script. Console messages are displayed in the compiler for any printf() commands in your script.
The easiest way to use this is create a Windows shortcut to TARGETGUI.exe (copy the icon created for the GUI when you installed TARGET, or create a new shortcut for TARGETGUI.exe). Then right click and select Properties to bring up the shortcut options. Change the options as follows (use the exact text given, including quotes, replacing anything to match your path names or file name of course):
Target: "C:\Program Files (x86)\Thrustmaster\TARGET\x64\TARGETGUI.exe" -r "MyScript.tmc"
Start In: C:\Users\Mike\AppData\Roaming\Thrustmaster\TARGET\Scripts
Click OK to close the dialog. Now you have an icon that will compile and run your script when you double click on it.
To use this to run a script at Windows startup, put the shortcut in your Startup Folder. All programs or shortcuts in this folder are run at boot. Here is the path to the StartUp folder.
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
Unfortunately, you can't run a script and have it exit. I mean, you can exit any script with the Abort(); function (immediately stops the script - see Abort() in hid.tmh for more info), but this won't exit the TARGETGUI.exe program window. Also, if you try to run another script by double clicking on another shortcut icon intended to run a script, it won't work until you manually close the previous script window. To solve this, you could probably use the TARGET system() command to run a windows CMD prompt command to kill the TARGETGUI process. This will stop the script and kill the TARGET GUI compiler. See this site for an explanation on how to use taskkill to do this:
https://www.wikihow.com/Kill-a-Process-in-Command-PromptAlso, there is some more discussion at the DCS forums about using nircmdc.exe along with the above ideas to hide the TARGETGUI.exe program. See here:
https://forums.eagle.ru/showthread.php?t=144584NirCMD can be found here. There are a variety of other useful programs at Nirsoft.net which may be useful to run from a TARGET script using system(). For example, NirCmd can change the computer's sound volume.
https://www.nirsoft.net/utils/nircmd.html