zerenx

zxEliteWTM

Jan 22nd, 2015
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.13 KB | None | 0 0
  1. ; Settings
  2. Const $ED_Windowname = "Elite - Dangerous (CLIENT)"
  3. Const $WinBorderWidth = -8 ;pixels
  4. Const $WinBorderHeight = -30 ;pixels
  5. Const $TargetX = -1920 + $WinBorderWidth
  6. Const $TargetY = 0 + $WinBorderHeight
  7. Const $CheckEvery = 500 ;ms
  8.  
  9. ; Inits
  10. Opt("WinTitleMatchMode", 3)
  11. HotKeySet("#{BACKSPACE}", "Terminate") ;Win+Backspace hotkey to quit the script
  12. $OnTop = False
  13.  
  14. While 1
  15.     Sleep($CheckEvery)
  16.     Main()
  17. WEnd
  18.  
  19. Func Main()
  20.     If WinActive($ED_Windowname) Then
  21.         ; Check current window position, reposition if not at target coordinate
  22.         $Current_Window_Position = WinGetPos($ED_Windowname)
  23.         If ($Current_Window_Position[0] <> $TargetX) Or ($Current_Window_Position[1] <> $TargetY) Then
  24.             WinMove($ED_Windowname, "", $TargetX, $TargetY)
  25.         EndIf
  26.  
  27.         ; Set window to on top if active
  28.         If Not $OnTop Then
  29.             If WinSetOnTop($ED_Windowname, "", 1) Then
  30.                 $OnTop = True
  31.             EndIf
  32.         EndIf
  33.     Else
  34.         ; Set window to NOT on top if not active
  35.         If $OnTop Then
  36.             If WinSetOnTop($ED_Windowname, "", 0) Then
  37.                 $OnTop = False
  38.             EndIf
  39.         EndIf
  40.     EndIf
  41. EndFunc   ;==>Main
  42.  
  43. Func Terminate()
  44.     Exit
  45. EndFunc   ;==>Terminate
Advertisement
Add Comment
Please, Sign In to add comment