Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #SingleInstance Force ; Force only one instance of script
- #Persistent ; Ensure the script is permanently running
- ; CONFIGURATION ==================================================
- ; the choices available in the menu, separated with '|'
- listdata := "Quit Game|HyperSpin|Steam|Kodi|Sleep|Shutdown"
- ; total elements in menu
- elements = 6
- ; period for checking hyperspin running, in ms
- joyrate_check = 2000
- ; CUSTOM SCRIPTS =================================================
- ; These functions are executed when a menu item is chosen
- ; Function is automagically called from the menu item name
- ; Exemple: if the menu name is "Quit Game",
- ; the function FQuit_Game() will be called
- ; function is prefixed with 'F', spaces are replaced with '_'
- FQuit_Game() {
- ; We check for a special close event required
- if WinExist("ahk_class PhyreFrameworkClass") {
- Process Close, HotlineGL.exe
- } else if WinExist("ahk_class YYGameMakerYY") {
- Process Close, Savant_Ascent.exe
- ; Else we simply send the Escape key
- } else {
- Send {Escape}
- }
- }
- FHyperSpin() {
- Process Close, Kodi.exe
- Run, "steam://ExitSteam"
- if WinExist("ahk_class ThunderRT6FormDC") ; dafuq HyperSpin
- WinActivate
- else
- Run, "D:\HeavyBox\HyperSpin.exe"
- }
- FSteam() {
- Process Close, HyperSpin.exe
- Process Close, Kodi.exe
- FQuit_Game()
- Process Exist, Steam.exe
- if ErrorLevel
- Run, "steam://open/bigpicture"
- else
- Run, "C:\Program Files (x86)\Steam\Steam.exe" -bigpicture
- }
- FKodi() {
- Process Close, HyperSpin.exe
- Run, "steam://ExitSteam"
- FQuit_Game()
- if WinExist("ahk_class Kodi")
- WinRestore
- else
- Run, "D:\Kodi\Kodi.exe"
- }
- FSleep() {
- ; Sleep/Suspend:
- DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
- ; Hibernate:
- ; DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
- }
- FShutdown() {
- Shutdown, 1
- }
- ; ================================================================
- index = 1
- active := false
- prevj2kstatus := false
- ; Run Joy2Key timer check (that executes label 'CustomJoy2Key' regularly)
- setTimer, CustomJoy2Key, %joyrate_check%
- ; Gui menu settings
- Gui +LastFound +AlwaysOnTop +ToolWindow -Caption
- Gui, color, 000000
- Gui, font, s18 bold, Arial
- Gui, Add, Listbox, h192 vActionmenu Choose%index%, %listdata%
- ; Shows or hide menu
- Toggle_GUI() {
- global active
- if (active=true) {
- active := false
- Gui, Cancel
- } else {
- active := true
- Gui, Show ;, NoActivate ; this avoid activating ahk window
- }
- }
- ; Navigation in menu when menu active
- ChoiceMove(dir) {
- global index, elements
- elemv = elements - 1
- if (index > 0 and index < elements and dir = "down")
- index++
- else if (index > 1 and index < elemv and dir = "up")
- index--
- GuiControl, Choose, Actionmenu, %index%
- }
- ; Action on menu selection
- ChoiceValidate() {
- global Actionmenu, active
- Gui, Submit
- active := false
- StringReplace, Actionmenu, Actionmenu, %A_SPACE%, _, All
- ; Run the function named F[menu_entry]
- F%Actionmenu%()
- }
- ; xb360 RHat shows/hide menu
- 1joy10::Toggle_GUI()
- ; navigation hotkeys only when menu active
- #IfWinActive ahk_class AutoHotkeyGUI
- 1joy1::ChoiceValidate()
- 1joy3::ChoiceMove("down")
- 1joy4::ChoiceMove("up")
- return
- ; The 'function' that checks regularly if HyperSpin is active
- ; If yes it runs Joy2Key, else it kills it
- CustomJoy2Key:
- if WinActive("ahk_class ThunderRT6FormDC") {
- if (prevj2kstatus=false) {
- Run, D:\HeavyBox\Joy2key\JoyToKey.exe
- prevj2kstatus := true
- }
- } else {
- if (prevj2kstatus=true) {
- Process Close, JoyToKey.exe
- prevj2kstatus := false
- }
- }
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement