This repository was archived by the owner on Nov 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTechnic_Launcher_Source.txt
More file actions
82 lines (81 loc) · 3.21 KB
/
Technic_Launcher_Source.txt
File metadata and controls
82 lines (81 loc) · 3.21 KB
1
on trim_line(this_text, trim_chars, trim_indicator) -- 0 = beginning, 1 = end, 2 = both set x to the length of the trim_chars -- TRIM BEGINNING if the trim_indicator is in {0, 2} then repeat while this_text begins with the trim_chars try set this_text to characters (x + 1) thru -1 of this_text as string on error -- the text contains nothing but the trim characters return "" end try end repeat end if -- TRIM ENDING if the trim_indicator is in {1, 2} then repeat while this_text ends with the trim_chars try set this_text to characters 1 thru -(x + 1) of this_text as string on error -- the text contains nothing but the trim characters return "" end try end repeat end if return this_textend trim_lineon run set FilePath to path to me set FilePath to POSIX path of FilePath set this_text to FilePath trim_line(this_text, "Test.scpt", 1) set FilePath to result set launcher to "cd " & FilePath & "Contents/Resources/launcher/" do shell script "curl http://mirror.technicpack.net/files/technic-launcher-latest.jar >> " & FilePath & "/Contents/Resources/temp/" & "technic-launcher-latest.jar" try do shell script "cp -n -r " & FilePath & "Contents/Resources/temp/technic-launcher-latest.jar " & FilePath & "Contents/Resources/launcher/technic-launcher-latest.jar" end try do shell script "md5 " & FilePath & "Contents/Resources/temp/technic-launcher-latest.jar" set md5latest to result trim_line(md5latest, "MD5 (", 0) set md5latest to result trim_line(md5latest, FilePath, 0) set md5latest to result trim_line(md5latest, "Contents/Resources/temp/technic-launcher-latest.jar) = ", 0) set md5latest to result do shell script "md5 " & FilePath & "Contents/Resources/launcher/technic-launcher-latest.jar" set md5current to result trim_line(md5current, "MD5 (", 0) set md5current to result trim_line(md5current, FilePath, 0) set md5current to result trim_line(md5current, "Contents/Resources/Launcher/technic-launcher-latest.jar) = ", 0) set md5current to result if md5latest is not md5current then set answer to button returned of ¬ (display dialog ¬ "A new client update as found! Update?" with title ¬ ¬ "New Update!" buttons {"Not Now", "Update"} ¬ default button 2) if answer is "Update" then do shell script "rm " & FilePath & "Contents/Resources/launcher/technic-launcher-latest.jar" try do shell script "cp -r " & FilePath & "Contents/Resources/temp/technic-launcher-latest.jar " & FilePath & "Contents/Resources/launcher/technic-launcher-latest.jar" end try do shell script "rm " & FilePath & "Contents/Resources/temp/technic-launcher-latest.jar" display alert "Update Successful!" do shell script launcher & ";java -jar technic-launcher-latest.jar" end if if answer is "Not Now" then do shell script "rm " & FilePath & "Contents/Resources/temp/technic-launcher-latest.jar" do shell script launcher & ";java -jar technic-launcher-latest.jar" end if end if if md5latest is md5current then do shell script "rm " & FilePath & "Contents/Resources/temp/technic-launcher-latest.jar" do shell script launcher & ";java -jar technic-launcher-latest.jar" end if (md5latest is md5current) & (md5latest is not md5current)end run