-
Notifications
You must be signed in to change notification settings - Fork 0
/
PegasusGameLauncher.ahk
67 lines (57 loc) · 1.86 KB
/
PegasusGameLauncher.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <[email protected]>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#Persistent
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
HideShowTaskbar(hide := hide)
HideShowTaskbar(action) {
static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA)
}
WA=%A_screenwidth%
HA=%A_screenheight%
MouseMove, WA, HA ,, R
Gui, Color, black
Gui -Caption
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%
; Store the arguments passed to it
arg1 := A_Args[1]
arg2 := A_Args[2]
; If appropriate, run the steam game
steam(args)
{
searchString := "steam:"
IfInString, args, %searchString%
{
; When coming from Pegasus through Launchbox, we need to split the string since it is written incorrectly
StringSplit, outputArray, args, :
Run, steam://rungameid/%outputArray3%
} else {
; In case this is used outside the Pegasus/LB combo
Run, steam://rungameid/%args%
}
}
; Run the correct command based on whether there is a switch argument
switch arg1
{
case "-s": ; Steam
steam(arg2)
default: ; Everything else
Run, %arg1%
}
sleep, 10000
WinGetActiveTitle, Title
WinWait, %Title%
WinWaitClose
ExitApp