#NoEnv #Persistent #SingleInstance #MaxHotkeysPerInterval 500 #InstallKeybdHook SendMode Input SetWorkingDir %A_ScriptDir% setkeydelay, 10, 10 Check_ForUpdate() OnLoad() #IfWinActive Elite - Dangerous ^!s::StartSwitch() ^!t::SendEvent {Space Down} ;~Shift::KeyState() ^f11::Pause f11::Reload ^!n::BuyMeritsLoop() ^!m::BuyMerits() ^!z::PlayIn("OpenStart") ^!x::PlayIn("PrivateStart") ^!c::PlayIn("SoloStart") +Up::LetsDoThis("2.0, 4.0, 0.0") +Down::LetsDoThis("2.0, 0.0, 4.0") +Left::LetsDoThis("4.0, 2.0, 0.0") +Right::LetsDoThis("1.5, 0.5, 4.0") #IfWinActive StartSwitch() { global SendEvent {Escape Down} Sleep 100 SendEvent {Escape Up} sleep 500 WhichSwitch() } WhichSwitch() { global if (CurrentSwitch = 0 || CurrentSwitch = "") { EDSubMenu = SoloStart DoSwitch() CurrentSwitch = 1 return } if (CurrentSwitch = 1) { EDSubMenu = OpenStart DoSwitch() CurrentSwitch = 2 return } if (CurrentSwitch = 2) { EDSubMenu = PrivateStart DoSwitch() if %A_UserName% = ZeroPoke { EDSubMenu = PrivateStart DoSwitch() } else { EDSubMenu = OpenStart DoSwitch() } CurrentSwitch = 0 return } } DoSwitch() { global EDMenu = ExitMain HighLight() ClickOn() WhiteCheck() WaitForMM() EDMenu = StartMain HighLight() ClickOn() EDMenu = %EDSubMenu% HighLight() ClickOn() SendEvent {Space up} } PlayIn(Where) { global SendEvent {Escape Down} Sleep 100 SendEvent {Escape Up} sleep 500 EDMenu = ExitMain HighLight() ClickOn() WhiteCheck() WaitForMM() EDMenu = StartMain HighLight() ClickOn() EDMenu = %Where% HighLight() ClickOn() if Where = PrivateStart { if %A_UserName% = ZeroPoke { EDSubMenu = PrivateStart } else { EDSubMenu = SoloStart } HighLight() ClickOn() } SendEvent {Space up} } HighLight() { global loop { sleep 500 MouseMove %EDMenu%X, %EDMenu%Y PixelGetColor testColour, %EDMenu%X, %EDMenu%Y, RGB if testColour contains 0xFF { SendEvent {Space up} break } } } ClickOn() { global loop { sleep 500 MouseMove %EDMenu%X, %EDMenu%Y, SendEvent {Space Down} sleep 300 SendEvent {Space up} MouseMove %EDMenu%X+100, %EDMenu%Y sleep 300 PixelGetColor testColour, %EDMenu%X, %EDMenu%Y, RGB if testColour not contains 0xFF { break } } } WhiteCheck() { loop { sleep 500 MouseMove 900, 666 sleep 250 PixelGetColor, testColour, 900, 666 if testColour = 0xFFFFFF MouseMove 900, 666 SendEvent {Space Down} sleep 250 PixelGetColor, testColour, 900, 666 if testColour != 0xFFFFFF SendEvent {Space up} break } } WaitForMM() { global loop { sleep 500 PixelSearch opX, opY, 1200, 560, 1230, 590, 0xFFFEFF, fast if ErrorLevel = 0 { break } } } OnLoad() { global ExitMainX = 600 ExitMainY = 392 StartMainX = 600 StartMainY = 250 OpenStartX = 600 OpenStartY = 215 PrivateStartX = 600 PrivateStartY = 250 SoloStartX = 600 SoloStartY = 285 } BuyMeritsLoop() { Inputbox TotalLoops,How many loops? WinWaitActive Elite sleep 1000 loop %TotalLoops% { BuyMerits() sleep 500 }} BuyMerits() { global setkeydelay, 30, 30 SleepAmount = 500 MeritAmount = 10 SendEvent s sleep %SleepAmount% SendEvent {Space} sleep %SleepAmount% sleep %SleepAmount% loop %MeritAmount% { SendEvent d sleep 400 } SendEvent {Space} sleep %SleepAmount% sleep %SleepAmount% SendEvent {Space} sleep %SleepAmount% } KeyState() { global state := GetKeyState("JoyPOV") if (state = 0 || state = 31500) ; Up LetsDoThis("2.0, 4.0, 0.0") if (state = 9000 || state = 4500) ; Right LetsDoThis("1.5, 0.5, 4.0") if (state = 27000 || state = 13500) ; Left LetsDoThis("4.0, 2.0, 0.0") if (state = 18000 || state = 22500) ; Down LetsDoThis("2.0, 0.0, 4.0") } LetsDoThis(PIPValue) { setkeydelay, 10, 10 SendEvent {Down} ; Reset PIPs if (PIPValue = "1.5, 1.5, 3.0") SendEvent {Right} if (PIPValue = "1.5, 3.0, 1.5") SendEvent {up} if (PIPValue = "3.0, 1.5, 1.5") SendEvent {left} if (PIPValue = "1.0, 1.0, 4.0") SendEvent {right} {right} if (PIPValue = "2.5, 2.5, 1.0") SendEvent {left} {up} if (PIPValue = "1.0, 4.0, 1.0") SendEvent {up} {up} if (PIPValue = "2.5, 1.0, 2.5") SendEvent {left} {right} if (PIPValue = "4.0, 1.0, 1.0") SendEvent {left} {left} if (PIPValue = "1.0, 2.5, 2.5") SendEvent {up} {right} if (PIPValue = "3.5, 0.5, 2.0") SendEvent {left} {left} {right} if (PIPValue = "2.0, 0.5, 3.5") SendEvent {left} {right} {right} if (PIPValue = "0.5, 3.5, 2.0") SendEvent {up} {up} {right} if (PIPValue = "0.5, 2.0, 3.5") SendEvent {up} {right} {right} if (PIPValue = "2.0, 3.5, 0.5") SendEvent {left} {up} {up} if (PIPValue = "3.5, 2.0, 0.5") SendEvent {left} {left} {up} if (PIPValue = "2.0, 0.0, 4.0") SendEvent {left} {right} {right} {right} if (PIPValue = "3.0, 3.0, 0.0") SendEvent {left} {left} {up} {up} if (PIPValue = "2.0, 4.0, 0.0") SendEvent {left} {up} {up} {up} if (PIPValue = "0.0, 3.0, 3.0") SendEvent {up} {up} {right} {right} if (PIPValue = "0.0, 4.0, 2.0") SendEvent {up} {up} {right} {up} if (PIPValue = "4.0, 0.0, 2.0") SendEvent {left} {left} {right} {left} if (PIPValue = "3.0, 0.0, 3.0") SendEvent {left} {left} {right} {right} if (PIPValue = "4.0, 2.0, 0.0") SendEvent {left} {left} {up} {left} if (PIPValue = "0.0, 2.0, 4.0") SendEvent {up} {right} {right} {right} if (PIPValue = "1.0, 1.5, 3.5") SendEvent {up} {right} {right} {right} {left} if (PIPValue = "1.5, 3.5, 1.0") SendEvent {left} {up} {up} {up} {right} if (PIPValue = "3.5, 1.0, 1.5") SendEvent {left} {left} {right} {left} {up} if (PIPValue = "1.5, 1.0, 3.5") SendEvent {left} {right} {right} {right} {up} if (PIPValue = "1.0, 3.5, 1.5") SendEvent {up} {up} {right} {up} {left} if (PIPValue = "3.5, 1.5, 1.0") SendEvent {left} {left} {up} {left} {right} if (PIPValue = "1.0, 2.0, 3.0") SendEvent {left} {right} {right} {right} {up} {up} if (PIPValue = "0.5, 2.5, 3.0") SendEvent {up} {right} {right} {right} {left} {up} if (PIPValue = "1.0, 3.0, 2.0") SendEvent {left} {up} {up} {up} {right} {right} if (PIPValue = "3.0, 2.0, 1.0") SendEvent {left} {left} {right} {left} {up} {up} if (PIPValue = "3.0, 0.5, 2.5") SendEvent {left} {left} {right} {left} {up} {right} if (PIPValue = "0.5, 3.0, 2.5") SendEvent {up} {up} {right} {up} {left} {right} if (PIPValue = "3.0, 2.5, 0.5") SendEvent {left} {left} {up} {left} {right} {up} if (PIPValue = "2.5, 0.5, 3.0") SendEvent {left} {right} {right} {right} {up} {left} if (PIPValue = "2.0, 1.0, 3.0") SendEvent {up} {right} {right} {right} {left} {left} if (PIPValue = "2.5, 3.0, 0.5") SendEvent {left} {up} {up} {up} {right} {left} if (PIPValue = "3.0, 1.0, 2.0") SendEvent {left} {left} {up} {left} {right} {right} if (PIPValue = "2.0, 3.0, 1.0") SendEvent {up} {up} {right} {up} {left} {left} if (PIPValue = "4.0, 1.5, 0.5") SendEvent {left} {left} {right} {left} {up} {up} {left} if (PIPValue = "4.0, 0.5, 1.5") SendEvent {left} {left} {up} {left} {right} {right} {left} if (PIPValue = "0.5, 1.5, 4.0") SendEvent {left} {right} {right} {right} {up} {up} {right} if (PIPValue = "2.5, 2.0, 1.5") SendEvent {left} {left} {up} {left} {right} {up} {right} if (PIPValue = "1.5, 2.5, 2.0") SendEvent {up} {up} {right} {up} {left} {left} {right} if (PIPValue = "1.5, 0.5, 4.0") SendEvent {up} {right} {right} {right} {left} {left} {right} if (PIPValue = "3.5, 2.5, 0.0") SendEvent {left} {up} {up} {up} {right} {left} {left} if (PIPValue = "2.5, 1.5, 2.0") SendEvent {left} {left} {right} {left} {up} {up} {right} if (PIPValue = "0.0, 2.5, 3.5") SendEvent {up} {up} {right} {up} {left} {right} {right} if (PIPValue = "1.5, 4.0, 0.5") SendEvent {up} {up} {right} {up} {left} {left} {up} if (PIPValue = "3.5, 0.0, 2.5") SendEvent {left} {right} {right} {right} {up} {left} {left} if (PIPValue = "0.5, 4.0, 1.5") SendEvent {left} {up} {up} {up} {right} {right} {up} if (PIPValue = "2.0, 2.5, 1.5") SendEvent {left} {up} {up} {up} {right} {left} {right} if (PIPValue = "2.5, 0.0, 3.5") SendEvent {left} {left} {right} {left} {up} {right} {right} if (PIPValue = "0.0, 3.5, 2.5") SendEvent {up} {right} {right} {right} {left} {up} {up} if (PIPValue = "2.5, 3.5, 0.0") SendEvent {left} {left} {up} {left} {right} {up} {up} if (PIPValue = "1.5, 2.0, 2.5") SendEvent {up} {right} {right} {right} {left} {left} {up} if (PIPValue = "2.0, 1.5, 2.5") SendEvent {left} {right} {right} {right} {up} {left} {up} } Check_ForUpdate(_ReplaceCurrentScript = 1, _SuppressMsgBox = 0, _CallbackFunction = "", ByRef _Information = "") { global ;Version.ini file format - this is just an example of what the version.ini file would look like ; ;[Info] ;Version=1.9 ;URL=http://www.mywebsite.com/my%20file.ahk or .exe ;MD5=00000000000000000000000000000000 or omit this key completly to skip the MD5 file validation Static Script_Name := "ED Switchie" ;Your script name , Version_Number := 1.5 ;The script's version number , Update_URL := "https://zeropoke.net/scripts/_UpdaterVersion_EDS.ini" ;The URL of the version.ini file for your script , Retry_Count := 3 ;Retry count for if/when anything goes wrong Random,Filler,10000000,99999999 Version_File := A_Temp . "\" . Filler . ".ini" , Temp_FileName := A_Temp . "\" . Filler . ".tmp" , VBS_FileName := A_Temp . "\" . Filler . ".vbs" Loop,% Retry_Count { _Information := "" UrlDownloadToFile,%Update_URL%,%Version_File% IniRead,Version,%Version_File%,Info,Version,N/A If (Version = "N/A"){ FileDelete,%Version_File% If (A_Index = Retry_Count) _Information .= "The version info file doesn't have a ""Version"" key in the ""Info"" section or the file can't be downloaded." Else Sleep,500 Continue } If (Version > Version_Number){ If (_SuppressMsgBox != 1 and _SuppressMsgBox != 3){ MsgBox,0x4,New version available,There is a new version of %Script_Name% available.`nCurrent version: %Version_Number%`nNew version: %Version%`n`nWould you like to download it now? IfMsgBox,Yes MsgBox_Result := 1 } If (_SuppressMsgBox or MsgBox_Result){ IniRead,URL,%Version_File%,Info,URL,N/A If (URL = "N/A") _Information .= "The version info file doesn't have a valid URL key." Else { ;SplitPath,URL,,,Extension Extension = exe If (Extension = "ahk" And A_AHKPath = "") _Information .= "The new version of the script is an .ahk filetype and you do not have AutoHotKey installed on this computer.`r`nReplacing the current script is not supported." Else If (Extension != "exe" And Extension != "ahk") _Information .= "The new file to download is not an .EXE or an .AHK file type. Replacing the current script is not supported." Else { IniRead,MD5,%Version_File%,Info,MD5,N/A Loop,% Retry_Count { UrlDownloadToFile,%URL%,%Temp_FileName% IfExist,%Temp_FileName% { If (MD5 = "N/A"){ _Information .= "The version info file doesn't have a valid MD5 key." , Success := True Break } Else { Ptr := A_PtrSize ? "Ptr" : "UInt" , H := DllCall("CreateFile",Ptr,&Temp_FileName,"UInt",0x80000000,"UInt",3,"UInt",0,"UInt",3,"UInt",0,"UInt",0) , DllCall("GetFileSizeEx",Ptr,H,"Int64*",FileSize) , FileSize := FileSize = -1 ? 0 : FileSize If (FileSize != 0){ VarSetCapacity(Data,FileSize,0) , DllCall("ReadFile",Ptr,H,Ptr,&Data,"UInt",FileSize,"UInt",0,"UInt",0) , DllCall("CloseHandle",Ptr,H) , VarSetCapacity(MD5_CTX,104,0) , DllCall("advapi32\MD5Init",Ptr,&MD5_CTX) , DllCall("advapi32\MD5Update",Ptr,&MD5_CTX,Ptr,&Data,"UInt",FileSize) , DllCall("advapi32\MD5Final",Ptr,&MD5_CTX) FileMD5 := "" Loop % StrLen(Hex:="123456789ABCDEF0") N := NumGet(MD5_CTX,87+A_Index,"Char"), FileMD5 .= SubStr(Hex,N>>4,1) . SubStr(Hex,N&15,1) VarSetCapacity(Data,FileSize,0) , VarSetCapacity(Data,0) If (FileMD5 != MD5){ FileDelete,%Temp_FileName% If (A_Index = Retry_Count) _Information .= "The MD5 hash of the downloaded file does not match the MD5 hash in the version info file." Else Sleep,500 Continue } Else Success := True } Else { DllCall("CloseHandle",Ptr,H) Success := True } } } Else { If (A_Index = Retry_Count) _Information .= "Unable to download the latest version of the file from " . URL . "." Else Sleep,500 Continue } } } } } } Else _Information .= "No update was found." FileDelete,%Version_File% Break } If (_ReplaceCurrentScript And Success){ ;SplitPath,URL,,,Extension Extension = exe Process,Exist MyPID := ErrorLevel VBS_P1 = (LTrim Join`r`n On Error Resume Next Set objShell = CreateObject("WScript.Shell") objShell.Run "TaskKill /F /PID %MyPID%", 0, 1 Set objFSO = CreateObject("Scripting.FileSystemObject") ) If (A_IsCompiled){ SplitPath,A_ScriptFullPath,,Dir,,Name VBS_P2 = (LTrim Join`r`n Finished = False Count = 0 Do Until (Finished = True Or Count = 5) Err.Clear objFSO.CopyFile "%Temp_FileName%", "%Dir%\%Name%.%Extension%", True If (Err.Number = 0) then Finished = True objShell.Run """%Dir%\%Name%.%Extension%""" Else WScript.Sleep(1000) Count = Count + 1 End If Loop objFSO.DeleteFile "%Temp_FileName%", True ) Return_Val := Temp_FileName } Else { If (Extension = "ahk"){ FileMove,%Temp_FileName%,%A_ScriptFullPath%,1 If (Errorlevel) _Information .= "Error (" . Errorlevel . ") unable to replace current script with the latest version." Else { VBS_P2 = (LTrim Join`r`n objShell.Run """%A_ScriptFullPath%""" ) Return_Val := A_ScriptFullPath } } Else If (Extension = "exe"){ SplitPath,A_ScriptFullPath,,FDirectory,,FName FileMove,%Temp_FileName%,%FDirectory%\%FName%.exe,1 if A_ScriptFullPath not contains ahk FileDelete,%A_ScriptFullPath% VBS_P2 = (LTrim Join`r`n objShell.Run """%FDirectory%\%FName%.exe""" ) Return_Val := FDirectory . "\" . FName . ".exe" } Else { FileDelete,%Temp_FileName% _Information .= "The downloaded file is not an .EXE or an .AHK file type. Replacing the current script is not supported." } } VBS_P3 = (LTrim Join`r`n objFSO.DeleteFile "%VBS_FileName%", True ) If (_SuppressMsgBox < 2) { If (InStr(VBS_P2, "Do Until (Finished = True Or Count = 5)")) { VBS_P3 .= "`r`nIf (Finished = False) Then" VBS_P3 .= "`r`nWScript.Echo ""Update failed.""" VBS_P3 .= "`r`nElse" If (Extension != "exe") VBS_P3 .= "`r`nobjFSO.DeleteFile """ A_ScriptFullPath """" VBS_P3 .= "`r`nWScript.Echo ""Update completed successfully.""" VBS_P3 .= "`r`nEnd If" } Else VBS_P3 .= "`r`nWScript.Echo ""Update complected successfully.""" } FileDelete,%VBS_FileName% FileAppend,%VBS_P1%`r`n%VBS_P2%`r`n%VBS_P3%,%VBS_FileName% If (_CallbackFunction != ""){ If (IsFunc(_CallbackFunction)) %_CallbackFunction%() Else _Information .= "The callback function is not a valid function name." } RunWait,%VBS_FileName%,%A_Temp%,VBS_PID Sleep,2000 Process,Close,%VBS_PID% _Information := "Error (?) unable to replace current script with the latest version.`r`nPlease make sure your computer supports running .vbs scripts and that the script isn't running in a pipe." } _Information := _Information = "" ? "None" : _Information Return Return_Val }