-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoulette.ahk
More file actions
115 lines (97 loc) · 2.67 KB
/
Roulette.ahk
File metadata and controls
115 lines (97 loc) · 2.67 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
HITMAPS™ Roulette Launcher by tuglaw
This launcher runs as a background process in Windows.
If HITMAN3.exe or LocalGhostPatcher.exe aren't running,
the launcher will close automatically after a few seconds.
*/
#SingleInstance Force
#NoEnv
#Persistent
#WinActivateForce
SetWorkingDir %A_ScriptDir%
DetectHiddenWindows, On
; Tray Menu
Menu, Tray, NoStandard
Menu, Tray, Add, Exit, TrayExit
Menu, Tray, Tip, HITMAPS™ Roulette Launcher
TrayExit()
{
ExitApp
}
; LocalGhostPatcher needs elevated rights to run.
If ( not A_IsAdmin )
{
Try
Run *RunAs "%A_ScriptFullPath%"
Catch
ExitApp
}
OnExit( "ExitFunc" )
If !FileExist( "LocalGhostPatcher.exe" )
{
MsgBox, 016, Error, LocalGhostPatcher.exe must be located in:`n"\HITMAN3\Roulette\LocalGhostPatcher.exe"`n`nPress OK to close the launcher.
IfMsgBox OK
ExitApp
}
SetTimer, CheckIfRunning, 300000 ; Initial run check for HITMAN3.exe or LocalGhostPatcher.exe.
If ( ProcessExist( "LocalGhostPatcher.exe" ) ) ; Avoids opening a second instance of LocalGhostPatcher when launching.
Process, Close, LocalGhostPatcher.exe
If ( !ProcessExist( "HITMAN3.exe" ) )
{
Try
Run, %A_ScriptDir%\..\Retail\HITMAN3.exe ; Starts HITMAN 3.
Catch
{
MsgBox, 016, Error, Roulette.exe must be located in:`n"\HITMAN3\Roulette\Roulette.exe"`n`nPress OK to close the launcher.
IfMsgBox OK
ExitApp
}
}
SetTimer, checkStartup, 250 ; Checks if HITMAN 3 has started.
checkStartup()
{
SetTimer, checkStartup, Off
If ( ProcessExist( "HITMAN3.exe" ) )
{
#IfWinNotActive, ahk_exe HITMAN3.exe ; Checks if HITMAN 3 isn't in focus.
{
WinActivate, ahk_exe HITMAN3.exe ; Forces and waits for HITMAN 3 to be in focus.
WinWaitActive, ahk_exe HITMAN3.exe
}
#If
#IfWinActive, ahk_exe HITMAN3.exe
{
SetTimer, checkStartup, Off ; Stops checking if HITMAN 3 has started.
If ( !ProcessExist( "LocalGhostPatcher.exe" ) )
{
Run, LocalGhostPatcher.exe,, Min
SetTimer, CheckIfRunning, 6000 ; Change run check timer.
}
Return
}
#If
}
Else
SetTimer, checkStartup, 250
}
#IfWinActive, ahk_exe HITMAN3.exe ; Close Roulette Launcher when closing HITMAN 3 with Alt+F4.
~!F4::
ExitApp
Return
#If
CheckIfRunning()
{
If ( ProcessExist( "LocalGhostPatcher.exe" ) && !ProcessExist( "HITMAN3.exe" ) )
|| ( !ProcessExist( "LocalGhostPatcher.exe" ) && !ProcessExist( "HITMAN3.exe" ) )
ExitApp
}
ProcessExist( Name )
{
Process, Exist, %Name%
Return Errorlevel
}
ExitFunc() ; Closes LocalGhostPatcher when the Roulette Launcher closes.
{
If ( ProcessExist( "LocalGhostPatcher.exe" ) )
Process, Close, LocalGhostPatcher.exe
}