AUA348 Posted February 11, 2023 Report Posted February 11, 2023 Dear all, I have a lua script for automatic change of view: cycleViews.lua It used to work but I haven't used it for quite a while now. So, here comes the problem: once I run the lua script (execution and kill of the script is assigned to a joy-button) the script is executed. So far so good. In the log file (FSUIPC7.log) it can be seen that the desired keypresses are sent to MSFS. However, these keypresses don't cause the desired funcion to happen. If I press the keys manually within MSFS, everything works like it should, but for some reason (I'm not so much into lua scripting to be honest...) the keypresses sent by FSUIPC are not working. Is there anyone here, who can help me in solving this issue? Best regards, Chris
John Dowson Posted February 11, 2023 Report Posted February 11, 2023 Does MSFS have the focus? MSFS needs to have the focus to receive key events. Alternatively, you can set the following parameter in the [General] section of your FSUIPC7.ini file: SetForegroundOnKeySend=Yes Otherwise you can use ipc.keypressplus with an option parameter of 4 to change the focus to MSFS before the keystroke is sent, or 12 to do this and also return the focus to the original active window after the keypress has been sent. John
AUA348 Posted February 11, 2023 Author Report Posted February 11, 2023 Hi John, I will give it a try! Thanks, Chris
AUA348 Posted February 11, 2023 Author Report Posted February 11, 2023 Hello John again, I tried both but no change so far. Was that the right way of including the optional parameter? -> ipc.keypressplus(0x31, 16, 4) Cheers, Chris
John Dowson Posted February 11, 2023 Report Posted February 11, 2023 Yes, should be - I will take a look later today - need to pop out for a few hours. I will let you know once I have taken a look. Also, please remember that when you attach log files, please attach a full log file and not a continuation log (i.e. don't use the New log feature). Does it work if you manually give MSFS the focus? Also. please check that you are using the latest official release 7.3.16, or the latest beta 7.3.17a (available from the Announcements sub-forum). Thanks, John
AUA348 Posted February 11, 2023 Author Report Posted February 11, 2023 Yes, I'm using the latest release. Updated it prior to posting here as I thought it might be an issue. No it also doesn't work when manually giving FS2020 the focus. What I have noticed is, that once the script runs and I put any window on top of MSFS, MSFS jumps on top whenever a view change in the lua file is triggered. That was also the case before setting SetForegroundOnKeySend=Yes and using the keypressplus command. Looking forward to your feedback! Cheers, Chris
John Dowson Posted February 11, 2023 Report Posted February 11, 2023 4 hours ago, AUA348 said: What I have noticed is, that once the script runs and I put any window on top of MSFS, MSFS jumps on top whenever a view change in the lua file is triggered. That was also the case before setting SetForegroundOnKeySend=Yes and using the keypressplus command. Ok...then it already sets the FS to the foreground. Strange it isn't wotking as the key presses are being sent, and as the key presses work directly in MSFS. Did you notice when this stopped working (e.g. after what update)? Sorry but I haven't had time to look at this today - will hopefully get a chance tomorrow... Cheers, John
AUA348 Posted February 11, 2023 Author Report Posted February 11, 2023 That's a good question. Would guess around a year or so. Don't worry, we don't have any stress here 🙂 Look at it whenever you have the time... Cheers, Chris
AUA348 Posted February 12, 2023 Author Report Posted February 12, 2023 Hi John, for any reason I don't understand everything is working today. Just wanted to let you know... Cheers, Chris
John Dowson Posted February 12, 2023 Report Posted February 12, 2023 Ah, ok....thanks for letting me know. Very strange... John
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now