SlipHavoc / DCSAutoMate

Automate DCS World with Python scripts and DCS BIOS.
MIT License
9 stars 0 forks source link

Window title is now "Digital Combat Simulator"? #1

Open JDeeth opened 11 months ago

JDeeth commented 11 months ago

Hi, thanks for a fantastic project - absolute gamechanger! When I was a bus driver, when I got in the cab in the evening, I'd adjust my seat just so, set the dashboard to dark mode, and put blu-tac on all the pointless LED status lights Volvo cluttered the cab with - made for a much nicer working environment - but an absolute pain in the neck to do the equivalent with the scrollwheel in DCS. I found your repo yesterday, spent an hour or two getting DCS-BIOS and CTRL-REF working, and then made a preflight script for the Gazelle that sets most of the brightness controls to 5%, turns on the HOT3 system and lifts the covers on the crucial switches - it's made a huge improvement!

To get DCSAutoMate to work with DCS 2.9 I had to change the code to look for the window titled "Digital Combat Simulator", not "DCS". I suspect this changed at the same time as they updated the desktop icons?

Rosherau commented 10 months ago

Hi, I believe i may need to do the same.

I get this error when it try to run the script 9/1 for hornet. Select a script function to run (number): 1 ATTENTION: You must remap "Throttle (Left) - IDLE" to LAlt+Home, and "Throttle (Left) - OFF" to LAlt+End. This is because pyWinAuto doesn't support RAlt or RCtrl. Trying to connect to DCS window by title: "DCS.openbeta"... Trying to connect to DCS window by title: "DCS" Couldn't find any active DCS window. Please make sure DCS is running before running script, or use debug flag. Traceback (most recent call last): File "DCSAutoMate.py", line 349, in app = Application().connect(title="DCS.openbeta") File "pywinauto\application.py", line 997, in connect File "pywinauto\findwindows.py", line 87, in find_element pywinauto.findwindows.ElementNotFoundError: {'title': 'DCS.openbeta', 'backend': 'win32', 'visible_only': False}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "DCSAutoMate.py", line 353, in app = Application().connect(title="DCS") File "pywinauto\application.py", line 997, in connect File "pywinauto\findwindows.py", line 87, in find_element pywinauto.findwindows.ElementNotFoundError: {'title': 'DCS', 'backend': 'win32', 'visible_only': False}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "DCSAutoMate.py", line 356, in quit('') NameError: name 'quit' is not defined [15172] Failed to execute script 'DCSAutoMate' due to unhandled exception!

Rosherau commented 10 months ago

I tried a few things to get this to work: I changed the dcsautomate.py file active window to "digital combat simulator" think it was line of code 353. app = Application().connect(title="Digital Combat Simulator") But then i couldnt compile the /py file to exe. so I had to install python and type this in cmd prompt: .\DCSAutoMate.exe --file \DCSAutoMateScripts\FA-18C --dcspath "F:\Eagle Dynamics\DCS World OpenBeta\bin-mt" And some how it worked after reading help files for a few hours (im a noob at this)

Now im trying to install and set the path for pyinstaller (its already isntalled somewhere on my pc) and get it to make a .exe from the dcsautomate.py so i dont need to make a .bat file for the code.

UPDATE: I found a way to force the pyinstaller scripts folder path in THIS PC/ windows advanced SYSTEM settings / ENVIROMENT VARIABLES / (select PATH and press EDIT, then NEW,
C:\Users\yourname\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts SAVE.

pyinstaller yourprogram.py pyinstaller -F yourprogram.py There you go you have the .exe , then replace the origional dcsautomate.exe with the one that was just made as it needs to be in the same folder with the scripts.