jollyjack Posted March 9, 2023 Posted March 9, 2023 Is disabling Alt-F4 possible from within the game? 1
Sketch Posted March 9, 2023 Posted March 9, 2023 Considering it's a Windows application, and all windows applications can be shut down with Alt + F4. The answer is no. 1
JG27*PapaFly Posted March 9, 2023 Posted March 9, 2023 3 hours ago, jollyjack said: Is disabling Alt-F4 possible from within the game? Easily doable via following autohotkey script. You must install the ahk scripting language, which is for free. Paste following lines into an empty .txt file, which you then save as .ahk and execute. #Persistent #SingleInstance Force #IfWinactive, IL-2.exe !F4::Return 1
jollyjack Posted March 10, 2023 Author Posted March 10, 2023 Must try that, keep hitting too Alt F4 easily when changing view (Alt_F2) ... changing back to "normal" is possible too?
Zooropa_Fly Posted March 10, 2023 Posted March 10, 2023 Would it not be easier to re-assign your Alt-F commands ? 1
JG27*PapaFly Posted March 10, 2023 Posted March 10, 2023 (edited) 4 hours ago, Zooropa_Fly said: Would it not be easier to re-assign your Alt-F commands ? You cannot re-assign Alt+F4 to any game function when using the in-game key mapping feature. Alt+F4 immediately kills the game. 4 hours ago, jollyjack said: Must try that, keep hitting too Alt F4 easily when changing view (Alt_F2) ... changing back to "normal" is possible too? Here's an updated and annotated version of the script (I'm finally at my PC and not mobile). This version will trigger Alt+F2 when in-game. You can adapt that to your liking. When outside the game, you will have the usual Alt+F4 functionality. ;Autoexecute section. This section is immediately executed when you start the script #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. #Persistent ;Maintains the script active in the notification area #SingleInstance Force ;Prevents multiple instances of the script ;Hotkey section. These labels or threads are only executed when you press the respective hotkeys #IfWinactive, ahk_exe Il-2.exe ;Following hotkey is only functional if IL-2.exe is the active window. !F4:: ;Alt+F4 Send {Alt down} ;Presses the Alt key and keeps it pressed Sleep, 30 ;Waits for 30 milliseconds (this is so the game has time to register the Alt press) Send, {F2 down} ;Presses the F2 key and keeps it pressed Sleep, 30 ;Waits for 30 milliseconds (this is so the game has time to register the F2 press) Send, {F2 up} Send {Alt up} Return #IfWinActive ;Whatever lines of script may follow are functional independent of the currently active window. And here's an example how you can re-map Alt+F4 functionality to a double-tap of the F4 key. You can paste this to the end of the script above. You can have as many hotkeys in one script as you wish. #IfWinactive, ahk_exe Il-2.exe ;Following hotkey is only functional if IL-2.exe is the active window. $F4:: ;Kill app via F4 double tap KeyWait, F4 ;Waits for key release KeyWait, F4, D T0.2 ;Waits 0.2 seconds for the key to be pressed again If Errorlevel ;Single tap occured { Send {F4 down} Sleep 30 Send {F4 up} } else ;Double tap occured Send {Alt down}{F4}{Alt up} return #IfWinActive ;Whatever lines of script may follow are functional independent of the currently active window. Edited March 10, 2023 by JG27_PapaFly 1
jollyjack Posted March 10, 2023 Author Posted March 10, 2023 (edited) Thanks ... Maybe something for a sticky? PS Alt_F2 is fully functional already in the gameplay mode for a sequence of fixcamera views, so i would not want that changed. Edited March 10, 2023 by jollyjack
Zooropa_Fly Posted March 10, 2023 Posted March 10, 2023 2 hours ago, JG27_PapaFly said: You cannot re-assign Alt+F4 to any game function when using the in-game key mapping feature. Alt+F4 immediately kills the game I meant not using Alt F anything in-game. i.e. re-assingning Alt F1,2,3 and Alt F5,6,7 to something else. S!
JG27*PapaFly Posted March 10, 2023 Posted March 10, 2023 2 hours ago, jollyjack said: Thanks ... Maybe something for a sticky? PS Alt_F2 is fully functional already in the gameplay mode for a sequence of fixcamera views, so i would not want that changed. I know, but you mentioned that you sometimes hit Alt+F4 by accident instead of Alt+F2. That's why I remapped Alt+F4 to Alt+F2 in my example. If you don't want that, just use the following, which renders Alt+F4 functionless in IL-2. ;Autoexecute section. This section is immediately executed when you start the script #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. #Persistent ;Maintains the script active in the notification area #SingleInstance Force ;Prevents multiple instances of the script ;Hotkey section. These labels or threads are only executed when you press the respective hotkeys #IfWinactive, ahk_exe Il-2.exe ;Following hotkey is only functional if IL-2.exe is the active window. !F4:: ;Alt+F4 Return 1 hour ago, Zooropa_Fly said: I meant not using Alt F anything in-game. i.e. re-assingning Alt F1,2,3 and Alt F5,6,7 to something else. S! Ahhh, now I get it. That would be a solution, but with the sheer number of key bindings I wouldn't want to give up the Alt+F combinations. 1
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