Guest User

NetfliXBMC Xbox controller remote support

a guest
Sep 27th, 2014
219
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MouseMove, 1920, 1080
  2. Click
  3. Send f
  4.  
  5.  
  6. ; Increase the following value to make the mouse cursor move faster:
  7. JoyMultiplier = 0.30
  8.  
  9. ; Decrease the following value to require less joystick displacement-from-center
  10. ; to start moving the mouse.  However, you may need to calibrate your joystick
  11. ; -- ensuring it's properly centered -- to avoid cursor drift. A perfectly tight
  12. ; and centered joystick could use a value of 1:
  13. JoyThreshold = 10
  14.  
  15. ; Change the following to true to invert the Y-axis, which causes the mouse to
  16. ; move vertically in the direction opposite the stick:
  17. InvertYAxis := false
  18.  
  19. ; Change these values to use joystick button numbers other than 1, 2, and 3 for
  20. ; the left, right, and middle mouse buttons.  Available numbers are 1 through 32.
  21. ; Use the Joystick Test Script to find out your joystick's numbers more easily.
  22. ButtonLeft = 9
  23.  
  24. ; If your system has more than one joystick, increase this value to use a joystick
  25. ; other than the first:
  26. JoystickNumber = 1
  27.  
  28. ; END OF CONFIG SECTION -- Don't change anything below this point unless you want
  29. ; to alter the basic nature of the script.
  30.  
  31. #SingleInstance
  32.  
  33. JoystickPrefix = %JoystickNumber%Joy
  34. Hotkey, %JoystickPrefix%%ButtonLeft%, ButtonLeft
  35.  
  36. ; Calculate the axis displacements that are needed to start moving the cursor:
  37. JoyThresholdUpper := 50 + JoyThreshold
  38. JoyThresholdLower := 50 - JoyThreshold
  39. if InvertYAxis
  40.     YAxisMultiplier = -1
  41. else
  42.     YAxisMultiplier = 1
  43.    
  44. settimer, close_script, 3000
  45. SetTimer, WatchJoystick, 10  ; Monitor the movement of the joystick.
  46. SetTimer, WatchAxis, 10
  47.  
  48. Joy1::Send {Space}
  49. Joy8::Send f
  50. Joy7::
  51. Send {Esc}
  52. MouseMove, 1920, 1080
  53. Click
  54. return
  55.  
  56. Joy5::
  57.  While GetKeyState("Joy5","p"){
  58.   Send {Left}
  59.   Sleep 100
  60.  }
  61. return
  62.  
  63. Joy6::
  64.  While GetKeyState("Joy6","p"){
  65.   Send {Right}
  66.   Sleep 100
  67.  }
  68. return
  69.  
  70. Joy2::
  71. Send {Esc}
  72. Send !{F4}
  73. ExitApp
  74.  
  75. return  ; End of auto-execute section.
  76.  
  77.  
  78. ; The subroutines below do not use KeyWait because that would sometimes trap the
  79. ; WatchJoystick quasi-thread beneath the wait-for-button-up thread, which would
  80. ; effectively prevent mouse-dragging with the joystick.
  81.  
  82. ButtonLeft:
  83. SetMouseDelay, -1  ; Makes movement smoother.
  84. MouseClick, left,,, 1, 0, D  ; Hold down the left mouse button.
  85. SetTimer, WaitForLeftButtonUp, 10
  86. return
  87.  
  88. WaitForLeftButtonUp:
  89. if GetKeyState(JoystickPrefix . ButtonLeft)
  90.     return  ; The button is still, down, so keep waiting.
  91. ; Otherwise, the button has been released.
  92. SetTimer, WaitForLeftButtonUp, off
  93. SetMouseDelay, -1  ; Makes movement smoother.
  94. MouseClick, left,,, 1, 0, U  ; Release the mouse button.
  95. return
  96.  
  97.  
  98. WatchAxis:
  99. GetKeyState, JoyR, JoyR  ; Get position of X axis.
  100. if JoyR =
  101.     return
  102. KeyToHoldDownPrev = %KeyToHoldDown%  ; Prev now holds the key that was down before (if any).
  103.  
  104. if JoyR > 70
  105.     KeyToHoldDown = Down
  106. else if JoyR < 30
  107.     KeyToHoldDown = Up
  108. else
  109.     KeyToHoldDown =
  110.  
  111. if KeyToHoldDown = %KeyToHoldDownPrev%  ; The correct key is already down (or no key is needed).
  112.     {
  113.     if KeyToHoldDown
  114.         Send, {%KeyToHoldDown% down}  ; Auto-repeat the keystroke.
  115.     return
  116.     }
  117.  
  118. ; Otherwise, release the previous key and press down the new key:
  119. SetKeyDelay -1  ; Avoid delays between keystrokes.
  120. if KeyToHoldDownPrev   ; There is a previous key to release.
  121.     Send, {%KeyToHoldDownPrev% up}  ; Release it.
  122. if KeyToHoldDown   ; There is a key to press down.
  123.     Send, {%KeyToHoldDown% down}  ; Press it down.
  124. return
  125.  
  126.  
  127.  
  128.  
  129. WatchJoystick:
  130. MouseNeedsToBeMoved := false  ; Set default.
  131. SetFormat, float, 03
  132. GetKeyState, joyx, %JoystickNumber%JoyX
  133. GetKeyState, joyy, %JoystickNumber%JoyY
  134. if joyx > %JoyThresholdUpper%
  135. {
  136.     MouseNeedsToBeMoved := true
  137.     DeltaX := joyx - JoyThresholdUpper
  138. }
  139. else if joyx < %JoyThresholdLower%
  140. {
  141.     MouseNeedsToBeMoved := true
  142.     DeltaX := joyx - JoyThresholdLower
  143. }
  144. else
  145.     DeltaX = 0
  146. if joyy > %JoyThresholdUpper%
  147. {
  148.     MouseNeedsToBeMoved := true
  149.     DeltaY := joyy - JoyThresholdUpper
  150. }
  151. else if joyy < %JoyThresholdLower%
  152. {
  153.     MouseNeedsToBeMoved := true
  154.     DeltaY := joyy - JoyThresholdLower
  155. }
  156. else
  157.     DeltaY = 0
  158. if MouseNeedsToBeMoved
  159. {
  160.     SetMouseDelay, -1  ; Makes movement smoother.
  161.     MouseMove, DeltaX * JoyMultiplier, DeltaY * JoyMultiplier * YAxisMultiplier, 0, R
  162. }
  163. return
  164.  
  165. close_script:
  166.  
  167. IfWinExist , Netflix - Google Chrome
  168.     return
  169. exitapp
RAW Paste Data