Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin1099 authored Mar 31, 2020
1 parent 1df9659 commit 75fac4f
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 14 deletions.
257 changes: 257 additions & 0 deletions AHK/Minecraft_Autolauncher.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
LineNr := 0
Select := 0
Dir := A_WorkingDir
Loca := ""
Loop, read, location.txt
{
LineNr++
Line%LineNr% := A_LoopReadLine
if ((LineNr = 1)and(A_LoopReadLine = "v0.5"))
LineNr := 1
else if (LineNr = 1){
Line2Nr := 0
MsgBox, 4, Minecraft AutoLaucher, The location.txt was not writen for Minecraft AutoLaucher v0.5`nDelete existing file(Yes)`nStop Script(No)
IfMsgBox, Yes
{
Line2Nr := 1
}
else
ExitApp
}
}
if (Line2Nr = 1) {
FileDelete, location.txt
LineNr := 0
Line2Nr := 0
}
if (LineNr = 0) {
FileAppend, v0.5, location.txt
LineNr++
}
if (LineNr = 1) {
Drives := ["A:\","B:\","C:\","D:\","E:\","F:\"]
VProgramFiles := ["Program Files (x86)\","Program Files\"]
Loop % Drives.Length() {
Drive := Drives[A_Index]
Loop % VProgramFiles.Length() {
ProgramFile := VProgramFiles[A_Index]
Loc := Drive ProgramFile "Minecraft Launcher\MinecraftLauncher.exe"
if FileExist(Loc){
if (Select = 0) {
Msgbox, 3, Minecraft AutoLaucher, Found a Minecraft Launcher at`n%Loc%`nUse it as your Minecraft Laucher Folder
IfMsgBox, Yes
{
Loca := Loc
Select := 1
}
IfMsgBox, No
Select := 3
if (Select = 0)
Select := 2
if (Select = 3)
Select := 0
}
}
}
}
if ((Select = 2) or (Select = 0)) {
While (Loca = "") {
FileSelectFile, Loca, 3, MinecraftLauncher.exe, Select the Minecraft launcher, Applications (*.exe; *.jar)
if (Loca = "")
MsgBox, You didn't select anything, try again.
}
Select := 1
}
if (Select = 1)
FileAppend, `n%Loca%, location.txt
Line2 := Loca
LineNr++
}
if (LineNr = 2) {

While (Profile = "")
{
InputBox, Profile, Minecraft AutoLaucher, Type the name of the Profile you want.`nIf there are multiple Profiles matching`nit will play the profile based on your sorting setting.`nThis setting is changeable in the next message box, , 350, 180, , , , , vivecraft
if (Profile = "")
MsgBox, You didn't wrote anything, try again.
}
FileAppend, `n%Profile%, location.txt
Line3 := %Profile%
LineNr++
}
if (LineNr = 3) {

MsgBox , 4, Minecraft AutoLaucher, SortByLastPlayed`n[Self explanatory]`n(Yes) `n`nor `n`nSortByName`n[1.12 first 1.13 second, If you use the version folder serching option(Next box) it doesn't make a difference]`n(No)
IfMsgBox, No
Select := "Name"
else
Select := "Last"
MsgBox, 3, Minecraft AutoLaucher, SortbyNameNew(Yes) `n`nSortByDateNew(No) `n`nUseOldVersion(Cancel)
IfMsgBox, No
{
Select1 := "Date"
MsgBox , 4, Minecraft AutoLaucher, SortUp jjjj.mm.dd`n[like this first to last 2020.03.10, 2020.03.09, 2020.03.08]`n(Yes)`n`nSortDown jjjj.mm.dd`n[like this fist to last 2020.03.08, 2020.03.09, 2020.03.10]`n(No)
IfMsgBox, No
Select2 := "SortDown"
else
Select2 := "SortUp"
}
IfMsgBox, Cancel
{
Select1 := "Old"
Select2 := "None"
}
else if !(Select1 = "Date")
{
Select1 := "Name"
MsgBox , 4, Minecraft AutoLaucher, SortUp[like this first to last 1.14.4, 1.13.2, 1.12](Yes)`n`nSortDown[like this fist to last 1.12, 1.13.2, 1.14.4](No)
IfMsgBox, No
Select2 := "SortDown"
else
Select2 := "SortUp"
}
Line4 := Select A_Tab Select1 A_Tab Select2
FileAppend, `n%Line4%, location.txt
LineNr++
}
if (LineNr = 4) {
LineOld := False
Loop, parse, Line4, %A_Tab%
{
if ((A_Index = 2) and (A_LoopField = "Old"))
LineOld := True
}
}

if ((LineNr = 4) and (LineOld = False)) {
Select := 0
MineVersions := A_AppData "\.minecraft\versions\*"
Msgbox, 4, Minecraft AutoLaucher, Use the default Minecraft Version Folder`n%MineVersions%`nUse it as your Minecraft Version Folder
IfMsgBox, Yes
{
Select := 1
}
if (Select = 0) {
While (MineVersion = "") {
FileSelectFolder, MineVersion, versions, 7, Select the Minecraft versions Folder
if (MineVersion = "")
MsgBox, You didn't select anything, try again.
}
MineVersion := MineVersion "\*"
MineVersions := MineVersion
}
Line5 := MineVersions
FileAppend, `n%MineVersions%, location.txt
LineNr++
LineNr++
}
else if (LineNr = 4) {
MineVersions := A_AppData "\.minecraft\versions"
Line5 := MineVersions
FileAppend, `n%MineVersions%, location.txt
LineNr++
LineNr++
}
if (LineNr = 6){
MsgBox, 4, Minecraft AutoLaucher, Start Minecraft Now
IfMsgBox, No
ExitApp
}

;Filecheck End
;Minecraft Start


Loop, parse, Line2, \
{
Minecraftexe := A_LoopField
}
Minecraftxex := "ahk_exe " Minecraftexe
IfWinNotExist, %Minecraftxex%
{
Run, %Line2%
sleep, 1000
}
IfWinNotActive, %Minecraftxex%
{
WinActivate, %Minecraftxex%
sleep, 100
}
IfWinActive, %Minecraftxex%
WinGetActiveStats, Title, Width, Height, X, Y
WPlayB := 260
HPlayB := 100
WPlay := Width / 2 + 370
HPlay := 200
WInstall := 340
HInstall := 100
WSearch := Width / 2 - 80
HSearch := 140
WSort := Width / 2 + 20
HSort := 150
WSortName := Width / 2 + 20
HSortName := 220
WSortPlayed := Width / 2 + 20
HSortPlayed := 190

;Variablen Ende
;Profiel Starten

SFile := Line3
Loop, parse, Line4, %A_Tab%
{
Index%A_Index% := A_LoopField
}
if (Index2 = "Name"){
FileList1 := ""
R := ""
if (Index3 = "SortDown")
R := "R"
Loop, Files, %Line5%, D
{
FileList1 = %FileList1%%A_LoopFileName%`n
}
Sort, FileList1 , %R%
Loop, Parse, FileList1, `n
{
if A_LoopField =
continue
else if (InStr(A_LoopField, Line3 , CaseSensitive := false, StartingPos := 1, Occurrence := 1))
SFile := A_LoopField
}
}
if (Index2 = "Date"){
FileList2 := ""
R := ""
if (Index3 = "SortDown")
R := "R"
Loop, Files, %Line5%, D
{
FileList2 = %FileList2%%A_LoopFileTimeModified%`t%A_LoopFileName%`n
}
Sort, FileList2 , %R%
Loop, Parse, FileList2, `n
{
if A_LoopField =
continue
else if (InStr(A_LoopField, Line3 , CaseSensitive := false, StartingPos := 1, Occurrence := 1))
SFile := A_LoopField
}
StringSplit, FileItem, SFile, %A_Tab% ; Split into two parts at the tab char.
SFile := FileItem2
}

MouseGetPos, MWidth, MHeight
MouseClick, Left, WPlayB, HPlayB, 1, 5
MouseClick, Left, WInstall, HInstall, 1, 5
MouseClick, Left, WSort, HSort, 1, 5
if (Index1 = "Last")
MouseClick, Left, WSortPlayed, HSortPlayed, 1, 5
else
MouseClick, Left, WSortName, HSortName, 1, 5
MouseClick, Left, WSearch, HSearch, 1, 5
sleep, 50
Send, %SFile%
sleep, 50
MouseClick, Left, WPlay, HPlay, 1, 5
MouseMove, MWidth, MHeight
Binary file added AHK/Minecraft_Autolauncher.ico
Binary file not shown.
Binary file added Minecraft_Autolauncher.exe
Binary file not shown.
97 changes: 83 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,95 @@
# Vivecraft-autolauncher
# Minecraft_Autolauncher -- *Vivecraft_Autolauncher Rewritten*
Based on a script by Mavi222.
But i basically rewrote the whole thing.
Rewritten by Marivn1099.

It's a simple AutoHotKey script which launches the Minecraft Launcher and automatically clicks on the Play button.
This is autolaucher super convenient because you can launch if directly from SteamVR without taking the headset off.
There are probably some unnecessary lines,
but i think ist fine you can look at it yourself its inside the AKH folder.

At the first launch of the program, it will ask you where your Minecraft launcher is located.
After the first time setup this happens:
1. Launches the Minecraft launcher
2. Activates the Minecraft launcher window
3. Klicks on the play button on the top to clear search bar
4. Klicks on the instalations button
5. Klicks on the sortby button
6. Klicks on the sortlastplayed or sortname botton based on yor choices
7. Klicks in the search bar
8. Types a profile name or a part of it based on your choises
9. Klicks on the play button on the first result

It helps running the game directly from the SteamVR without taking the Vive headset off.
# Download Section

It's one of my first AutoHotKey scripts so there are probably some unnecessary lines and other stuff.
Download the newest Version there:
https://github.com/marvin1099/Vivecraft-autolauncher/releases
Extract the Vivecraft-autolauncher-0.5.zip
Run the Minecraft_Autolauncher.exe
You antivirus may check the file but wont find anything special.

It should work like this:
# Tutorial Section

Launches the Minecraft launcher through command line
If you are not that advanced just hit enter to all the Questions.
I sorted them so you use the best in my opinion
If you do that it will start the latest Vivecraft version.
You only need to answer answer those questions once,
as long as you dont move the file.
to move the file also move location.txt,
if you dont the script will create a new location.txt,
and ask you again (questions below).

Waits 4 seconds

Clicks in the middle of the window, -64 pixels from the bottom, where the Play Button should be.
If you run it first time it test for a older config file.
The config file name is location.txt
if there is there is a file created in a other version,
it will ask you to delete that or stop the script.
If you want to run that script please click ok to delete it.
If you never had used this Launcher not you wont see that at all.

Installation: https://github.com/Mavi222/Vivecraft-autolauncher/wiki/Installation

TO-DO: I need to clean the script of the unnecessary, not working lines. Right now it works but the code is really bad. I also could make the script to ask you if you use the new or the old launcher so it's backwards compatible.
If you are a advanced user the first option is for setting up your Minecraft Lanucher location,
if your Lanucher is installed on Drive "A:\" to "F:\" In "\Program Files" or "\Program Files (x86)",
it will ask if you want to use that location.
If you have multiple installations and the on you want to use meets the named criteria,
just press no until it ask you for the right one then click yes.
If it doesn't ask you it will show a file selection Just select the Minecraft Lanucher.
If you want to select a Minecraft Lanucher in a another path click chancel,
and select the Minecraft Lanucher you want to use.

# Vivecraft Autolauncher Remake
Version 0.4 is a remake of the Vivecraft Autolauncher by Marvin1099

This version will search for a given name to start the profile you want.
In the next box type the important part of the profile name.
For example profile name "vivecraft-1.14.4-jrbudda-4-a0",
and "vivecraft-1.13.4-jrbudda-3-a0" type "vivecraft",
it will start the newer or older version based on you next answers.
If you type the exact name use the name after clicking on the profile,
and copy the version line after the line "release", "snapshot", "old_beta", or "old_alfa"
Then it will start olny this profile exept,
if there are 2 or more profiles that have the same name but have a longer name.
You can also copy the version name fom the minecraft version folder.
the easyest way to open this folder is by opining minecraft, the options, texturenpacks,
clicking on the open texturenpack folder, going one back on the opened File Explorer,
and double clicking on the version folder.



The next box shows the in Minecraft Lanucher installation sort opition setting,
its important for the script, it almost only matters,
if you select oldsort(cancel) in the next option because with that,
it will just type the name you typed in the last box and sort based on your opion here
if you use the oldsort(cancel) the setup is finished for you


In the new box it will ask you to sort by name(yes), date(no), or oldsort(cancel).
I already said something about the oldsort(cancel) option in the last Lineblock.
the name(yes) option wil sort by name and the date(no) option wil sort by date.
its based on your next opition if it sorts up or down up means,
first to last 1.14.4, 1.13.2, 1.12,
jjjj.mm.dd first to last 2020.03.10, 2020.03.09, 2020.03.08,
the down option is from last to first instead.


If you selected name(yes), or date(no) it will ask you for your minecraft version folder,
as i said it will ask if the the default folder is the correct one.
if not select the correct one like this.
type like this "C:\Users\%Username%\AppData\Roaming\.minecraft\versions".
replace the %Username% with your PC Username,
or just browse to your Minercraft Version Folder.

0 comments on commit 75fac4f

Please sign in to comment.