- (optional) key remapping (e.g. auto shoot to mouse button)
- clicking background accidentally does not make you lose focus from game screen
Code:
; RotMG Starter
; gtaking
; v.4
; 2017 II
; Works on desktop
; Space to close
; Creates Realm of the Mad God launcher script
; and its desktop shortcut (also speed hack cheat table)
; using given icon, standalone and client files
; which has a black background (toggle) and window concealer (optional) on top
; and is able to set process priority, resize game window or login (optional) automatically
; helps game window not to lose focus (clicks on ahk guis)
; allows keymapping of unchangable keys to mouse (optional)
#NoEnv
#Warn
#NoTrayIcon
#SingleInstance, Force
ListLines Off
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
SetWorkingDir %A_ScriptDir%
; lines to edit in created code (if manual way chosen)
; icon 18, sa 36, run 48, iconfile 151-154, ct 250
; should be edited manually
; user pass 224, 231
;Menu, Tray, Icon, console.dll, 1
Menu, Tray, Icon, Shell32.dll, 50
Menu, Tray, Tip, RotMG Starter
Menu, Tray, NoStandard
Menu, Tray, Icon
mainstate := 0
flashIconPath := "C:\Windows\SysWOW64\Macromed\Flash\FlashPlayerPlugin*.exe"
exePath =
swfPath =
iconPath =
exeOK := false
swfOK := false
iconOK := false
Gui, New, +HwndDragWindow +AlwaysOnTop +Owner, RotMG Starter
Gui, %DragWindow%: Color, black
Gui, %DragWindow%: Show, x100 y100 w500 h375
Gui, New, +HwndAAA +Parent%DragWindow% +Disabled -Caption -SysMenu -Theme +ToolWindow +AlwaysOnTop
Gui, %AAA%: +0x40000000 -0x80000000
Gui, %AAA%: Font, s12 cWhite, Terminal
Gui, %AAA%: Add, Text, x219 y150 w500 h30, RotMG
Gui, %AAA%: Font, s10 cWhite, Terminal
Gui, %AAA%: Add, Text, x221 y174 w500 h30, Starter
Gui, %AAA%: Color, black
Gui, %AAA%: Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% NoActivate
;Gui, %AAA%: Add, Text, x218 y186 w64 h6 0x6
Sleep, 2000
Gui, %AAA%: Destroy
mainstate := 1
Gui, %DragWindow%: Font, s11 cWhite, Terminal
; standalone and client boxes
Gui, %DragWindow%: Add, Text, x92 y124 w175 h13, flash projector
Gui, %DragWindow%: Add, Text, x136 y96 w36 h12 hwndExt1, exe
Control, Hide, , , ahk_id %Ext1%
Gui, %DragWindow%: Add, Text, x118 y98 w6 h12 0x6 hwndCol11
Gui, %DragWindow%: Add, Text, x176 y98 w6 h12 0x6 hwndCol12
Gui, %DragWindow%: Add, Text, x118 y110 w64 h6 0x6 hwndTop1
Gui, %DragWindow%: Add, Text, x118 y98 w64 h6 0x6 hwndBar1
Gui, %DragWindow%: Add, Text, x308 y124 w175 h13, game client
Gui, %DragWindow%: Add, Text, x338 y96 w36 h13 hwndExt2, swf
Control, Hide, , , ahk_id %Ext2%
Gui, %DragWindow%: Add, Text, x318 y98 w6 h12 0x6 hwndCol21
Gui, %DragWindow%: Add, Text, x376 y98 w6 h12 0x6 hwndCol22
Gui, %DragWindow%: Add, Text, x318 y110 w64 h6 0x6 hwndTop2
Gui, %DragWindow%: Add, Text, x318 y98 w64 h6 0x6 hwndBar2
; icon box
Gui, %DragWindow%: Add, Text, x215 y180 w175 h12, icon file
Gui, %DragWindow%: Add, Text, x238 y210 w36 h49 hwndExt3, ico`nswf`nexe`ndll
Control, Hide, , , ahk_id %Ext3%
Gui, %DragWindow%: Add, Text, x218 y208 w6 h6 0x6 hwndCol31
Gui, %DragWindow%: Add, Text, x276 y208 w6 h6 0x6 hwndCol32
Gui, %DragWindow%: Add, Text, x218 y202 w64 h6 0x6 hwndTop3
Gui, %DragWindow%: Add, Text, x218 y214 w64 h6 0x6 hwndBar3
;Gui, %DragWindow%: Font, s12 cWhite, Terminal
Gui, %DragWindow%: Add, Text, x213 y312 w80 h12 hwndTxt0, Drag Files
; WinSet, TransColor, F0F0F0, ahk_id %DragWindow%
Iconfile := "C:\Windows\System32\shell32.dll"
hMod := DllCall( "GetModuleHandle", str, Iconfile , ptr )
hIcon := DllCall( "LoadImage", ptr, hMod, uint, 50, uint, 1, int, 0, int, 0, uint, 0x8000, ptr )
SendMessage, 0x80, 0, hIcon, , ahk_id %DragWindow%
SendMessage, 0x80, 1, hIcon, , ahk_id %DragWindow%
SetTimer, Blink, 150
bcounter := 0
Return
GuiDropFiles:
WinActivate, ahk_id %DragWindow%
if (mainstate == 0)
Return
Loop, parse, A_GuiEvent, `n
{
SplitPath, A_LoopField, name, dir, ext
if (not iconOK and A_GuiX > 215 and A_GuiX < 290 and A_GuiY > 220 and A_GuiY < 295) {
iconPath = %A_LoopField%
if (ext == "dll") {
iconType := 0
Gui, %DragWindow%: Add, Picture, x218 y202 w64 h64 AltSubmit +BackgroundTrans Icon1, %iconPath%
}
else if (ext == "exe") {
iconType := 1
Gui, %DragWindow%: Add, Picture, x218 y202 w64 h64 AltSubmit +BackgroundTrans, %iconPath%
}
else if (ext == "ico") {
iconType := 2
Gui, %DragWindow%: Add, Picture, x218 y202 w64 h64 AltSubmit +BackgroundTrans, %iconPath%
}
else if (ext == "swf") {
iconType := 3
Loop, Files, %flashIconPath%
{
swfIcon = %A_LoopFileFullPath%
Break
}
Gui, %DragWindow%: Add, Picture, x218 y202 w64 h64 AltSubmit +BackgroundTrans Icon6, %swfIcon%
}
else {
Return
}
Gui, %DragWindow%: Color, black
iconOK := true
Control, Hide, , , ahk_id %Col31%
Control, Hide, , , ahk_id %Col32%
Control, Hide, , , ahk_id %Top3%
Control, Hide, , , ahk_id %Bar3%
if (mainstate == 2) {
ControlMove, , 208, 338, 180, 12, ahk_id %Txt0%
ControlSetText, , Create Script, ahk_id %Txt0%
}
}
else if (not exeOK and ext == "exe") {
exePath = %A_LoopField%
Gui, %DragWindow%: Add, Picture, x118 y52 w64 h64 AltSubmit +BackgroundTrans, %exePath%
Gui, %DragWindow%: Color, black
exeOK := true
Control, Hide, , , ahk_id %Col11%
Control, Hide, , , ahk_id %Col12%
Control, Hide, , , ahk_id %Top1%
Control, Hide, , , ahk_id %Bar1%
if (swfOK) {
mainstate := 2
if (iconOK) {
ControlMove, , 208, 338, 180, 12, ahk_id %Txt0%
ControlSetText, , Create Script, ahk_id %Txt0%
}
else {
ControlMove, , 166, 338, 180, 12, ahk_id %Txt0%
ControlSetText, , Create Iconless Script, ahk_id %Txt0%
}
}
}
else if (not swfOK and ext == "swf") {
swfPath = %A_LoopField%
Loop, Files, %flashIconPath%
{
swfIcon = %A_LoopFileFullPath%
Break
}
Gui, %DragWindow%: Add, Picture, x318 y52 w64 h64 AltSubmit +BackgroundTrans Icon6, %swfIcon%
Gui, %DragWindow%: Color, black
swfOK := true
Control, Hide, , , ahk_id %Col21%
Control, Hide, , , ahk_id %Col22%
Control, Hide, , , ahk_id %Top2%
Control, Hide, , , ahk_id %Bar2%
if (exeOK) {
mainstate := 2
if (iconOK) {
ControlMove, , 208, 338, 180, 12, ahk_id %Txt0%
ControlSetText, , Create Script, ahk_id %Txt0%
}
else {
ControlMove, , 166, 338, 180, 12, ahk_id %Txt0%
ControlSetText, , Create Iconless Script, ahk_id %Txt0%
}
}
}
}
Return
~LButton::
MouseGetPos, mouseX, mouseY, id
WinGetClass, class, ahk_id %id%
if (class = "AutoHotkeyGUI") {
if (mouseY < 25 and mouseX < 460) {
Loop { ; now theres tilde, no need
Sleep, 10
GetKeyState, state, LButton, P
if state = U
Break
}
}
else if (mainstate == 2 and mouseY > 325 and mouseY < 355 and mouseX > 155 and mouseX < 355) { ; create script
ControlMove, , 120, 338, 290, 12, ahk_id %Txt0%
ControlSetText, , desktop shortcut, ahk_id %Txt0%
SplitPath, exePath, name, dir
ahkfilePath = %dir%\Realm of the Mad God.ahk
ahkfile := FileOpen(ahkfilePath, "w")
ahkfileinput := "#NoEnv`r`n#NoTrayIcon`r`n#SingleInstance, Force`r`n#WinActivateForce`r`n#MaxThreadsPerHotkey 3`r`n#KeyHistory 0`r`nListLines Off`r`nSetBatchLines, -1`r`nSetWinDelay, -1`r`nSetControlDelay, -1`r`nSetKeyDelay, -1, -1`r`nSetMouseDelay, -1`r`nSetDefaultMouseSpeed, 0`r`nSendMode Input`r`nDetectHiddenWindows, On`r`n`r`n`r`nMenu, Tray, Icon, "
ahkfile.Write(ahkfileinput)
if (not iconOK) { ; dll
ahkfileinput := "Shell32.dll, 50"
}
else if (iconType == 0 or iconType == 1 or iconType == 2) ; dll, exe, ico
ahkfileinput := iconPath ", 1"
else if (iconType == 3) { ; swf
ahkfileinput := swfIcon ", 1"
}
ahkfile.Write(ahkfileinput)
ahkfileinput := ", 1`r`nMenu, Tray, Tip, Realm of the Mad God`r`nMenu, Tray, NoStandard`r`nMenu, Tray, Add, Remove Black Background, RemovingBlackBack`r`nMenu, Tray, Add, Quit, Exiting`r`nMenu, Tray, Icon`r`n`r`n`r`nOnExit, Exiting`r`n`r`n`r`nif not A_IsAdmin`r`n{`r`n`tRun *RunAs ""%A_ScriptFullPath%"", , UseErrorLevel`r`n`tExitApp`r`n}`r`n`r`n`r`nstandalone = " name "`r`n`r`n`; black alwaysontop frame that hides window frames, optional`r`nenableBlackTop = 1`r`n`r`n`r`nwinW := 960, winH := (A_ScreenHeight>800?800:734), winX := 0+ceil((A_ScreenWidth-960+150)/2.48), winY := 0+ceil((A_ScreenHeight-734-34)/2.84)`r`nwinsW := 804, winsH := 653, winsX := A_ScreenWidth/2-round(winsW/2,-1)+21+6, winsY := A_ScreenHeight/2-round(winsH/2,-2)-17`r`n`r`n`r`nstartWin() {`r`n`tglobal`r`n`tRun, """ dir "\%standalone%"" """ swfPath """`r`n`r`n`tReturn`r`n}`r`n`r`nonWinCloseExit() {`r`n`tglobal`r`n`tWinWait, ahk_exe %standalone%`r`n`t`r`n`tGui +LastFound`r`n`th := WinExist()`r`n`r`n`tDllCall(""RegisterShellHookWindow"", UInt, h)`r`n`tMsgNum := DllCall(""RegisterWindowMessage"", Str, ""SHELLHOOK"")`r`n`tOnMessage(MsgNum, ""ShellMessage"")`r`n`t`r`n`tReturn`r`n}`r`n`r`nShellMessage(wParam, lParam) {`r`n`tglobal`r`n`tif (wParam == 2) {`t`t`; HSHELL_WINDOWDESTROYED`r`n`t`tWinGet, pn, ProcessName, ahk_id %lParam%`r`n`r`n`t`tif (pn == standalone) {`r`n`t`t`tIfWinNotExist, ahk_exe %standalone%`t`t; need recheck`r`n`t`t`t`tGoSub, Exiting`r`n`t`t}`r`n`t}`r`n`telse if ((wParam == 32772 or wParam == 4) and enabledBlackTop) {`t`t`; HSHELL_WINDOWACTIVATED`r`n`t`tWinGet, pn, ProcessName, ahk_id %lParam%`r`n`t`t`r`n`t`tif (pn == standalone) {`r`n `tGoSub, BlackTopMinimizeCheck`r`n`t`t}`r`n`t`telse {`t`; another window is activated`r`n }`r`n`t}`r`n`t`r`n`tReturn`r`n}`r`n`r`nstartBlackBack() {`r`n`tglobal`r`n`tGui, New, +HwndBlackBack +Disabled -Caption -SysMenu -Theme +ToolWindow +AlwaysOnTop`r`n`tGui, %BlackBack%: Color, black`r`n`r`n`ttoggleAllButtons = 0`r`n`tGui, %BlackBack%: Font, s11 cWhite, Terminal`r`n`taddBlackBackSpeedHack()`r`n`r`n`tGui, %BlackBack%: Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%`r`n`r`n`tReturn`r`n}`r`n`r`naddBlackBackSpeedHack() {`r`n`tglobal`r`n`ttoggleSpeedHack = 0`r`n`tiX := A_ScreenWidth-290`r`n`tiY := A_ScreenHeight-260`r`n`tx := iX+136`r`n`ty := iY+96`r`n`tGui, %BlackBack%: Add, Text, x%x% y%y% w116 h12 hwndTxt0, speed hack`r`n`tx := iX+118`r`n`ty := iY+88`r`n`tGui, %BlackBack%: Add, Text, x%x% y%y% w140 h6 0x6 hwndBot0`r`n`tGui, %BlackBack%: Add, Text, x%x% y%y% w6 h22 0x6`t hwndCol01`r`n`tx := iX+258`r`n`tGui, %BlackBack%: Add, Text, x%x% y%y% w6 h22 0x6 hwndCol02`r`n`tx := iX+118`r`n`ty := iY+110`r`n`tGui, %BlackBack%: Add, Text, x%x% y%y% w146 h6 0x6 hwndTop0`r`n`r`n`thideButtonBlackBack()`r`n`r`n`tReturn`r`n}`r`n`r`nhideButtonBlackBack() {`r`n`tglobal`r`n`tControl, Hide, , , ahk_id %Txt0%`r`n`tControl, Hide, , , ahk_id %Bot0%`r`n`tControl, Hide, , , ahk_id %Col01%`r`n`tControl, Hide, , , ahk_id %Col02%`r`n`tControl, Hide, , , ahk_id %Top0%`r`n`r`n`tReturn`r`n}`r`n`r`nshowButtonBlackBack() {`r`n`tglobal`r`n`tControl, Show, , , ahk_id %Txt0%`r`n`tControl, Show, , , ahk_id %Bot0%`r`n`tControl, Show, , , ahk_id %Col01%`r`n`tControl, Show, , , ahk_id %Col02%`r`n`tControl, Show, , , ahk_id %Top0%`r`n`r`n`tReturn`r`n}`r`n`r`nsetWinIcon() {`r`n`tglobal`r`n`t"
ahkfile.Write(ahkfileinput)
if (not iconOK) { ; dll
ahkfileinput := "Iconfile := ""C:\Windows\System32\shell32.dll""`r`n`thMod := DllCall( ""GetModuleHandle"", str, Iconfile , ptr )`r`n`thIcon := DllCall( ""LoadImage"", ptr, hMod, uint, 50, uint, 1, int, 0, int, 0, uint, 0x8000, ptr )`r`n`tSendMessage, 0x80, 1, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_BIG`r`n`tSendMessage, 0x80, 0, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_SMALL`r`n"
FileCreateShortcut, %ahkfilePath%, %A_Desktop%\Realm of the Mad God.lnk, "%A_Desktop%", , Realm of the Mad God, C:\Windows\System32\shell32.dll, , 50, 7
}
else if (iconType == 0) ; dll
ahkfileinput := "Iconfile := """ iconPath """`r`n`thMod := DllCall( ""GetModuleHandle"", str, Iconfile , ptr )`r`n`thIcon := DllCall( ""LoadImage"", ptr, hMod, uint, 0, uint, 1, int, 0, int, 0, uint, 0x8000, ptr )`r`n`tSendMessage, 0x80, 1, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_BIG`r`n`tSendMessage, 0x80, 0, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_SMALL`r`n"
else if (iconType == 1) ; exe
ahkfileinput := "Iconfile := """ iconPath """`r`n`tDllCall(""shell32\ExtractIconEx"" (A_IsUnicode ? ""W"":""A""), ptr, &Iconfile, int, 0, PtrP, hIcon, PtrP, hIcon_small, uint, 1, uint)`r`n`tSendMessage, 0x80, 1, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_BIG`r`n`tSendMessage, 0x80, 0, hIcon_small, , ahk_exe %standalone%`t`t; WM_SETICON, ICON_SMALL`r`n"
else if (iconType == 2) ; ico
ahkfileinput := "Iconfile := """ iconPath """`r`n`thIcon := DllCall( ""LoadImage"", uint, 0, str, Iconfile , uint, 1, int, 0, int, 0, uint, 0x10, ptr )`r`n`tSendMessage, 0x80, 1, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_BIG`r`n`tSendMessage, 0x80, 0, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_SMALL`r`n"
else if (iconType == 3) { ; swf
ahkfileinput := "Iconfile := """ swfIcon """`r`n`tDllCall(""shell32\ExtractIconEx"" (A_IsUnicode ? ""W"":""A""), ptr, &Iconfile, int, 0, PtrP, hIcon, PtrP, hIcon_small, uint, 1, uint)`r`n`tSendMessage, 0x80, 1, hIcon, , ahk_exe %standalone%`t`t`t`t; WM_SETICON, ICON_BIG`r`n`tSendMessage, 0x80, 0, hIcon_small, , ahk_exe %standalone%`t`t; WM_SETICON, ICON_SMALL`r`n"
FileCreateShortcut, %ahkfilePath%, %A_Desktop%\Realm of the Mad God.lnk, "%A_Desktop%", , Realm of the Mad God, %swfIcon%, , 1, 7
}
if (iconOK and iconType != 3)
FileCreateShortcut, %ahkfilePath%, %A_Desktop%\Realm of the Mad God.lnk, "%A_Desktop%", , Realm of the Mad God, %iconPath%, , 1, 7
ahkfile.Write(ahkfileinput)
ahkfileinput := "`r`n`tReturn`r`n}`r`n`r`nsetWin() {`r`n`tglobal`r`n`tWinSetTitle, ahk_exe %standalone%, , Realm of the Mad God`r`n`tWinSet, Style, -0xC00000, ahk_exe %standalone%`r`n`tDllCall(""SetMenu"", uint, WinExist(""ahk_exe ""standalone), uint, 0)`r`n`r`n`tReturn`r`n}`r`n`r`nstartBlackTop() {`r`n`tglobal`r`n`tGui, New, +HwndBlackTop +Disabled -Caption -SysMenu -Theme +ToolWindow +AlwaysOnTop`r`n`tGui, %BlackTop%: Color, black`r`n`r`n`tGui, %BlackTop%: Show, x%winsX% y%winsY% w%winsW% h7`r`n`r`n`tGui, New, +HwndBlackLeft +Disabled -Caption -SysMenu -Theme +ToolWindow +AlwaysOnTop`r`n`tGui, %BlackLeft%: Color, black`r`n`tGui, %BlackLeft%: Show, x%winsX% y%winsY% w1 h%winsH%`r`n`tx := winsX+winsW-1`r`n`tGui, New, +HwndBlackRight +Disabled -Caption -SysMenu -Theme +ToolWindow +AlwaysOnTop`r`n`tGui, %BlackRight%: Color, black`r`n`tGui, %BlackRight%: Show, x%x% y%winsY% w1 h%winsH%`r`n`ty := winsY+winsH-1`r`n`tGui, New, +HwndBlackBot +Disabled -Caption -SysMenu -Theme +ToolWindow +AlwaysOnTop`r`n`tGui, %BlackBot%: Color, black`r`n`tGui, %BlackBot%: Show, x%winsX% y%y% w%winsW% h1`r`n`r`n`tenabledBlackTop = 1`r`n`t`r`n`tReturn`r`n}`r`n`r`nwaitScreenUntilNonBlack() {`r`n`tglobal`r`n`tSleep, 200`r`n`tWinSet, Top, , ahk_exe %standalone%`r`n`t`r`n`tLoop {`r`n`t`tSleep, 400`r`n`t`tIfWinNotActive, ahk_exe %standalone%`r`n`t`t`tWinActivate, ahk_exe %standalone%`r`n`r`n`t`tPixelGetColor, color1, 800-175, 160`r`n`t`tif (color1 != 0x000000)`r`n`t`t`tBreak`r`n`t}`r`n`r`n`tReturn`r`n}`r`n`r`nloginClick() {`r`n`tSleep, 300`r`n`tBlockInput, on`r`n`tMouseGetPos, mouseX, mouseY`r`n`tClick, 770, 40`r`n`tBlockInput, off`r`n`tClick, %mouseX%, %mouseY%, 0`r`n`r`n`tReturn`r`n}`r`n`r`nloginAsUser() {`r`n`tSleep, 600`r`n`ttmp = %ClipboardAll%`r`n`tClipboard = YOUR_EMAIL`r`n`tClipWait`r`n`tSend, ^v`r`n`tSleep, 120 `; pastewait`r`n`tClipboard =`r`n`tSleep, 300`r`n`tSend, {tab}`r`n`tClipboard = YOUR_PASSWORD`r`n`tClipWait`r`n`tSend, ^v`r`n`tSleep, 120 `; pastewait`r`n`tClipboard = %tmp%`r`n`tSleep, 300`r`n`tSend, {tab 2}`r`n`tSleep, 600`r`n`tSend, {enter}`r`n`t`r`n`tSleep, 2000`t`; timeout for disappearance of button when win rescale`r`n`tReturn`r`n}`r`n`r`npushButtonBlackBackSpeedHack() {`r`n`tglobal`r`n`ttoggleSpeedHack = 1`r`n`tshowButtonBlackBack()`r`n`r`n`tRun, """ dir "\speedhack.ct""`r`n`r`n`tWinWaitActive, Confirmation`r`n`tSend, {Enter}`r`n`r`n`tWinWait, Cheat Engine`r`n`tWinSet, Bottom, , Cheat Engine`r`n`tWinMove, Cheat Engine, , winX+winW-(75-3)-613, winY+winH-(75-26+10)-593, 613, 593`r`n`tWinSet, ExStyle, ^0x80, Cheat Engine`t`t`; 0x80 is WS_EX_TOOLWINDOW`r`n`r`n`tSleep, 1500`r`n`thideButtonBlackBack()`r`n`ttoggleSpeedHack = 0`r`n`r`n`tReturn`r`n}`r`n`r`nmakeWinBig() {`r`n`tglobal`r`n`tWinMove, ahk_id %BlackTop% , , , , winW-12`r`n`tWinMove, ahk_id %BlackLeft% , , , , , winH-6`r`n`tWinMove, ahk_id %BlackRight%, , , , , winH-6`r`n`tWinMove, ahk_id %BlackBot% , , , , winW-12`r`n`tSleep, 300`r`n`tWinMove, ahk_id %BlackTop% , , winX+6, winY`r`n`tWinMove, ahk_id %BlackLeft% , , winX+6, winY`r`n`tWinMove, ahk_id %BlackRight%, , winX-6+winW-1, winY`r`n`tWinMove, ahk_id %BlackBot% , , winX+6, winY+winH-1-6`r`n`r`n`tWinMove, ahk_exe %standalone%, , winX, winY, winW, winH`r`n`r`n`tReturn`r`n}`r`n`r`n`r`nstartWin()`r`n`r`nstartBlackBack()`r`n`r`nonWinCloseExit()`r`nsetWinIcon()`r`nsetWin()`r`n`r`nif (enableBlackTop)`r`n`tstartBlackTop()`r`nWinMove, ahk_exe %standalone%, , winsX-6, winsY`r`n`r`nProcess, Priority, %standalone%, high`r`nWinSet, AlwaysOnTop, off, ahk_id %BlackBack%`r`n`r`nwaitScreenUntilNonBlack()`r`n`r`nIfWinNotActive, ahk_exe %standalone%`r`n`tWinActivate, ahk_exe %standalone%`r`nPixelGetColor, color1, 800-117, 41`r`nPixelGetColor, color2, 800-92 , 41`r`nif (color1 == 0xFFFFFF and color2 == 0xFFFFFF) {`r`n`tloginClick()`r`n`tloginAsUser()`r`n`tmakeWinBig()`r`n}`r`nelse {`r`n`tmakeWinBig()`r`n}`r`n`r`nReturn`r`n`r`n`r`nBlackTopMinimizeCheck:`r`n`tLoop 10 {`r`n`t`tSleep, 20`t`; minimize wait loop`r`n`t`tWinGet, isMin, MinMax, ahk_exe %standalone%`r`n`t`t`r`n`t`tif (isMin != isMinLast)`r`n`t`t{`r`n`t`t`tif (isMin != -1) {`r`n`t`t`t`tGui, %BlackTop%: Show`r`n`t`t`t`tGui, %BlackLeft%: Show`r`n`t`t`t`tGui, %BlackRight%: Show`r`n`t`t`t`tGui, %BlackBot%: Show`r`n`t`t`t}`r`n`t`t`telse {`r`n`t`t`t`tGui, %BlackTop%: Show, Hide`r`n`t`t`t`tGui, %BlackLeft%: Show, Hide`r`n`t`t`t`tGui, %BlackRight%: Show, Hide`r`n`t`t`t`tGui, %BlackBot%: Show, Hide`r`n`t`t`t}`r`n`t`t`tisMinLast := isMin`r`n`t`t`tBreak`r`n`t`t}`r`n`t}`r`n`r`nReturn`r`n`r`n`r`nAddingBlackBack:`r`n`tMenu, Tray, Delete, Add Black Background`r`n`tMenu, Tray, Insert, Quit, Remove Black Background, RemovingBlackBack`r`n`tGui, %BlackBack%: Show`r`n`tWinActivate, ahk_exe %standalone%`r`n`r`nReturn`r`n`t`r`nRemovingBlackBack:`r`n`tMenu, Tray, Delete, Remove Black Background`r`n`tMenu, Tray, Insert, Quit, Add Black Background, AddingBlackBack`r`n`tGui, %BlackBack%: Hide`r`n`tWinActivate, ahk_exe %standalone%`r`n`t`r`nReturn`r`n`t`r`nExiting:`r`nGuiClose:`r`n`tWinActivate, ahk_id %BlackBack%`r`n`tIfWinExist, Cheat Engine`r`n`t`tWinClose, Cheat Engine`r`n`tWinClose, ahk_exe %standalone%`r`n`r`nExitApp`r`n`r`n`r`n~LButton::`r`n`tMouseGetPos, mouseX, mouseY, id`r`n`tWinGetClass, class, ahk_id %id%`r`n`r`n`tif (class == ""AutoHotkeyGUI"") {`r`n`t`tif (not WinExist(""Cheat Engine"") and mouseX > A_ScreenWidth-350 and mouseY > A_ScreenHeight-300 and not toggleSpeedHack) {`r`n`t`t`tpushButtonBlackBackSpeedHack()`r`n`t`t}`r`n`t`telse if (mouseX > A_ScreenWidth-350 and mouseY < 300 and not toggleAllButtons) {`r`n`t`t`ttoggleAllButtons = 1`r`n`t`t`tshowButtonBlackBack()`r`n`t`t`tWinActivate, ahk_exe %standalone%`r`n`t`t`tSleep, 2500`r`n`t`t`thideButtonBlackBack()`r`n`t`t`ttoggleAllButtons = 0`r`n`t`t}`r`n`t`telse {`r`n`t`t`tWinActivate, ahk_exe %standalone%`r`n`t`t}`r`n`t}`r`n`telse if (class == ""Shell_TrayWnd"") {`r`n`t`tif (mouseX >= A_ScreenWidth-5 and enabledBlackTop) {`r`n`t`t`tGoSub, BlackTopMinimizeCheck`r`n`t`t}`r`n`t}`r`n`r`nReturn`r`n`r`n`r`n~RButton::`r`n~XButton1::`r`n~XButton2::`r`n`tMouseGetPos, , , id`r`n`tWinGetClass, class, ahk_id %id%`r`n`r`n`tif (class == ""AutoHotkeyGUI"") {`r`n`t`tWinActivate, ahk_exe %standalone%`r`n`t}`r`n`r`nReturn`r`n`r`n`r`n#If WinActive(""ahk_exe ""standalone)`r`n`tXButton2::I`r`n`r`nReturn`r`n`r`n"
ahkfile.Write(ahkfileinput)
ahkfile.Close()
IfNotExist, %dir%\speedhack.ct
{
ctfileinput := "<?xml version=""1.0"" encoding=""utf-8""?>`r`n<CheatTable CheatEngineTableVersion=""18"">`r`n<CheatEntries/>`r`n<UserdefinedSymbols/>`r`n<LuaScript>`r`n`r`nopenProcess(""" name """)`r`n`r`nlastSpeed = 1`r`n`r`nfunction checkKeys(timer)`r`n`tif (isKeyPressed(VK_XBUTTON1))`r`n`tthen`r`n`t`tif lastspeed ~= 3`r`n`t`tthen`r`n`t`t`tspeedhack_setSpeed(3)`r`n`t`t`tlastSpeed = 3`r`n`t`tend`r`n`telse`r`n`t`tif lastspeed ~= 1`r`n`t`tthen`r`n`t`t`tspeedhack_setSpeed(1)`r`n`t`t`tlastSpeed = 1`r`n`t`tend`r`n`tend`r`nend`r`n`r`nt = createTimer(nil)`r`n`ttimer_setInterval(t, 10)`r`n`ttimer_onTimer(t, checkKeys)`r`n`ttimer_setEnabled(t, true)`r`n`r`n</LuaScript>`r`n</CheatTable>"
FileAppend, %ctfileinput%, %dir%\speedhack.ct
}
ControlSetText, , desktop shortcut has been created..., ahk_id %Txt0%
}
Return
}
else if (class = "Shell_TrayWnd") {
Return ; now theres tilde, no need to block
}
else {
if (mainstate == 2 and not iconOK) { ; repeated code
Loop 50 {
Sleep, 10
GetKeyState, state, LButton, P
if (state == "U")
Return
}
Control, Show, , , ahk_id %Ext3%
Loop {
Sleep, 10
GetKeyState, state, LButton, P
if (state == "U")
{
ControlMove, , , , , 1, ahk_id %Ext3%
Control, Hide, , , ahk_id %Ext3%
ControlMove, , , 240, , , ahk_id %Bar3%
ControlMove, , , , , 6, ahk_id %Col31%
ControlMove, , , , , 6, ahk_id %Col32%
Break
}
ControlGetPos, , z, , , , ahk_id %Bar3%
if (z < 285) {
a := (292-z)>>3
z := z+a
ControlMove, , , z, , , ahk_id %Bar3%
ControlMove, , , , , z-236, ahk_id %Ext3%
ControlMove, , , , , z-232, ahk_id %Col31%
ControlMove, , , , , z-232, ahk_id %Col32%
}
else if (z == 286) {
}
else {
z := 286
ControlMove, , , z, , , ahk_id %Bar3%
ControlMove, , , , , 49, ahk_id %Ext3%
}
}
Return
}
else if (mainstate != 1)
Return
Sleep, 500
Control, Show, , , ahk_id %Ext1%
Control, Show, , , ahk_id %Ext2%
Control, Show, , , ahk_id %Ext3%
GetKeyState, state, LButton, P
if (state == "D" and mainstate == 1) {
ControlMove, , 175, 338, 180, 12, ahk_id %Txt0%
ControlSetText, , Drop into the Window, ahk_id %Txt0%
}
Loop {
Sleep, 10
GetKeyState, state, LButton, P
if (state == "U")
{
ControlMove, , , , , 1, ahk_id %Ext3%
Control, Hide, , , ahk_id %Ext1%
Control, Hide, , , ahk_id %Ext2%
Control, Hide, , , ahk_id %Ext3%
ControlMove, , , 124, , , ahk_id %Bar1%
ControlMove, , , 124, , , ahk_id %Bar2%
ControlMove, , , 240, , , ahk_id %Bar3%
ControlMove, , , 130, , 6, ahk_id %Col11%
ControlMove, , , 130, , 6, ahk_id %Col12%
ControlMove, , , 130, , 6, ahk_id %Col21%
ControlMove, , , 130, , 6, ahk_id %Col22%
ControlMove, , , , , 6, ahk_id %Col31%
ControlMove, , , , , 6, ahk_id %Col32%
if (mainstate == 1) {
ControlMove, , 216, 338, 80, 12, ahk_id %Txt0%
ControlSetText, , Drag Files, ahk_id %Txt0%
}
Break
}
if (1) { ; one of them might be hidden but still move
ControlGetPos, , y, , , , ahk_id %Bar1%
if (y > 114) {
a := (114-y)>>5
y := y+a
ControlMove, , , y, , , ahk_id %Bar1%
ControlMove, , , y, , , ahk_id %Bar2%
a := y+6
b := 131-y
ControlMove, , , a, , b, ahk_id %Col11%
ControlMove, , , a, , b, ahk_id %Col12%
ControlMove, , , a, , b, ahk_id %Col21%
ControlMove, , , a, , b, ahk_id %Col22%
}
else if (y == 114) {
}
else {
y := 114
ControlMove, , , , , 13, ahk_id %Ext1%
ControlMove, , , , , 13, ahk_id %Ext2%
ControlMove, , , y, , , ahk_id %Bar1%
ControlMove, , , y, , , ahk_id %Bar2%
}
}
if (not iconOK) { ; repeated code
ControlGetPos, , z, , , , ahk_id %Bar3%
if (z < 285) {
a := (292-z)>>3
z := z+a
ControlMove, , , z, , , ahk_id %Bar3%
ControlMove, , , , , z-236, ahk_id %Ext3%
ControlMove, , , , , z-232, ahk_id %Col31%
ControlMove, , , , , z-232, ahk_id %Col32%
}
else if (z == 286) {
}
else {
z := 286
ControlMove, , , z, , , ahk_id %Bar3%
ControlMove, , , , , 49, ahk_id %Ext3%
}
}
}
}
Return
Blink:
if (bcounter = 19) {
Control, Hide, , , ahk_id %Txt0%
bcounter := 0
}
else if (bcounter = 0) {
Control, Show, , , ahk_id %Txt0%
bcounter++
}
else
bcounter++
Return
GuiClose:
Space::
ExitApp
Return
Edit: If IfWinNotExist recheck too fast, program may not close itself (happens rarely), then add
line before it.