Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Controls:
- ;
- ;Mouse movement: Left and/or Right analog
- ;Left-Click: A
- ;Right-Click: B
- ;Middle-Click: L3 or R3
- ;Arrow Keys: Dpad
- ;Enter: Y
- ;Scroll: X + Up / X + Down (Dpad)
- ;Minimize: LT
- ;Maximize: RT
- ;Copy: X + LT
- ;Paste: X + RT
- ;Alt-Tab: LB + Back
- ;Play/Pause Music: Start
- ;Next/Prev Track: Start + LT / Start + RT
- ;
- ;Toggle Script: LB + RB + X + A
- ;Switch Dominance: RB
- ;
- #SingleInstance, force
- DetectHiddenWindows, on
- Thread, Interrupt, 0
- MouseToggle := true
- Main = 1Joy
- state = on
- SetHotKeys:
- Hotkey, %Main%1, LeftClick, %state%
- Hotkey, %Main%2, RightClick, %state%
- Hotkey, %Main%4, EnterButton, %state%
- Hotkey, %Main%7, AltButton, %state%
- Hotkey, %Main%8, MusicStart, %state%
- Hotkey, %Main%9, L3Click, %state%
- Hotkey, %Main%10, R3Click, %state%
- if MouseToggle
- setTimer, WatchVars, 10
- return
- LeftClick:
- Suspend, Permit
- If (GetKeyState(Main . 3) and GetKeyState(Main . 5) and GetKeyState(Main . 6))
- {
- MouseToggle := !MouseToggle
- Suspend
- If MouseToggle
- setTimer, WatchVars, 10
- }
- Else If MouseToggle
- {
- MouseClick, Left,,, 1, 0, D
- SetTimer, LeftUp, 10
- }
- return
- LeftUp:
- If GetKeyState(Main . 1)
- return
- MouseClick, Left,,, 1, 0, U
- SetTimer, LeftUp, off
- return
- RightClick:
- MouseClick, Right,,, 1, 0, D
- SetTimer, RightUp, 10
- return
- RightUp:
- If GetKeyState(Main . 2)
- return
- MouseClick, Right,,, 1, 0, U
- SetTimer, RightUp, off
- return
- L3Click:
- R3Click:
- MouseClick, Middle,,, 1, 0, D
- SetTimer, MiddleUp, 10
- return
- return
- MiddleUp:
- If (GetKeyState(Main . 9) or GetKeyState(Main . 10))
- return
- MouseClick, Middle,,, 1, 0, U
- SetTimer, MiddleUp, off
- return
- EnterButton:
- Send {Enter}
- return
- MusicStart:
- setTimer, PlayPause, 10
- return
- PlayPause:
- If GetKeyState(Main . 8)
- return
- if !changedTrack
- {
- IfWinExist, MediaMonkey
- Send {Media_Play_Pause}
- else
- Run, MediaMonkey.exe, C:\Program Files (x86)\MediaMonkey
- }
- changedTrack := false
- setTimer, PlayPause, off
- return
- ;Alt Tab
- AltButton:
- If GetKeyState(Main . 5)
- {
- Send {Alt down}
- Send {Tab}
- SetTimer, AltTabbing, 10
- }
- return
- AltTabbing:
- If GetKeyState(Main . 5)
- return
- Send {Alt up}
- SetTimer, AltTabbing, off
- return
- LeftTrigger:
- If GetKeyState(Main . 8)
- {
- Send {Media_Prev}
- changedTrack := true
- return
- }
- setTimer, LTRelease, 10
- return
- LTRelease:
- If Triggers < 90
- {
- If GetKeyState(Main . 3)
- Send ^c
- else
- WinMinimize, A
- setTimer, LTRelease, off
- }
- return
- RightTrigger:
- If GetKeyState(Main . 8)
- {
- Send {Media_Next}
- changedTrack := true
- return
- }
- setTimer, RTRelease, 10
- return
- RTRelease:
- If Triggers > 10
- {
- If GetKeyState(Main . 3)
- Send ^v
- else
- {
- WinGet, isMax, MinMax, A
- If isMax <> 1
- WinMaximize, A
- else
- WinRestore, A
- }
- setTimer, RTRelease, off
- }
- return
- ; Monitors all variable switches
- WatchVars:
- Movement := false
- GetKeyState, xone, %Main%X
- GetKeyState, yone, %Main%Y
- GetKeyState, xtwo, %Main%U
- GetKeyState, ytwo, %Main%R
- GetKeyState, Dpad, %Main%POV
- GetKeyState, Triggers, %Main%Z
- movexone := 0
- moveyone := 0
- movextwo := 0
- moveytwo := 0
- ; Analog 1
- If xone > 70
- {
- movexone := (xone-70)/3
- Movement := true
- }
- else If xone < 30
- {
- movexone := (xone-30)/3
- Movement := true
- }
- If yone > 70
- {
- moveyone := (yone-70)/3
- Movement := true
- }
- else If yone < 30
- {
- moveyone := (yone-30)/3
- Movement := true
- }
- ; Analog 2
- If xtwo > 70
- {
- movextwo := (xtwo-70)
- Movement := true
- }
- else If xtwo < 30
- {
- movextwo := (xtwo-30)
- Movement := true
- }
- If ytwo > 70
- {
- moveytwo := (ytwo-70)
- Movement := true
- }
- else If ytwo < 30
- {
- moveytwo := (ytwo-30)
- Movement := true
- }
- ; Moves cursor by analog input
- If Movement
- {
- setMouseDelay, -1
- MouseMove, movexone+movextwo, moveyone+moveytwo, 0, R
- }
- ; LT and RT
- If Triggers > 90
- goSub, LeftTrigger
- If Triggers < 10
- goSub, RightTrigger
- ; DPad Control
- SendKeyPrev = %SendKey%
- SendKey =
- If (Dpad != -1)
- {
- If Dpad between 22500 and 31500
- SendKey = Left
- If Dpad between 9000 and 13500
- SendKey = Right
- If Dpad between 13500 and 22500
- {
- If GetKeyState(Main . 3)
- send {WheelDown}
- else
- SendKey = Down
- }
- If (Dpad > 31500 or Dpad < 4500)
- {
- If GetKeyState(Main . 3)
- send {WheelUp}
- else
- SendKey = Up
- }
- }
- if SendKey <> %SendKeyPrev%
- {
- if SendKey <>
- Send {%SendKey% down}
- if SendKeyPrev <>
- Send {%SendKeyPrev% up}
- }
- if !MouseToggle
- setTimer, WatchVars, off
- return
- ; Switch dominant controller
- 1Joy6::
- Suspend, Permit
- SwitchDom("1Joy")
- return
- 2Joy6::
- Suspend, Permit
- ;msgbox woot
- SwitchDom("2Joy")
- return
- 3Joy6::
- Suspend, Permit
- SwitchDom("3Joy")
- return
- 4Joy6::
- Suspend, Permit
- SwitchDom("4Joy")
- return
- SwitchDom(whJoy)
- {
- global state = "off"
- gosub, SetHotKeys
- global main = whJoy
- global state = "on"
- gosub, SetHotKeys
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment