Nilt

Elite Dangerous AltTab

Oct 24th, 2020 (edited)
1,582
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ;#Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. ;This script will activate your game window whenever
  7. ;any joystick axis changes. Handy for when you're
  8. ;Alt-Tabbed out of the game on your second monitor.
  9.  
  10. SetFormat, float, 03 ;remove decimals from joystick values
  11.  
  12. Loop
  13. {
  14.    if WinExist("ahk_exe EliteDangerous64.exe")
  15.    {
  16.       IfWinNotActive
  17.       {  
  18.          Loop
  19.          {
  20.  
  21.             ;get axis values        
  22.             GetKeyState, joyY, 1JoyY
  23.             GetKeyState, joyX, 1JoyX
  24.  
  25.             ;if any axis changes, activate game window
  26.             ;joystick 'rests' at 50
  27.  
  28.             if joyX not between 40 and 60
  29.             {
  30.                WinActivate
  31.                break
  32.             }
  33.             if joyY not between 40 and 60
  34.             {
  35.                WinActivate
  36.                break
  37.             }
  38.             if !WinExist("ahk_exe EliteDangerous64.exe")
  39.             {
  40.                break
  41.             }
  42.  
  43.          }              
  44.       }
  45.     }
  46. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×