Well I made this since I hated the whole opening my browser and what not to download the new beta client (If I could find the name of the Beta TextCtrl, I'd do it automatically but w/e).
Basically downloads what you have set in this.dlurl.
PHP Code:
//#CLIENTSIDE
function onCreated() {
// You'll have to fix this line.. well the start of it.
this.dlurl = "http://www.path.to/the/right/place/" @ getplatform() @ ".zip";
}
function ChatBar.onAction() {
if (ChatBar.text == "/download") {
ChatBar.text = "";
createGUI();
// Comment the line below if you want the
// joy of clicking a button.
downloadFile();
}
}
function createGUI() {
new GuiWindowCtrl("BetaDownloader") {
profile = GuiBlueWindowProfile;
width = 200;
height = 72;
x = (screenwidth - width) / 2;
y = (screenheight - height) / 2;
text = "Beta Downloader";
new GuiButtonCtrl("BetaDownloader_Download") {
profile = GuiBlueButtonProfile;
x = 10;
y = 30;
active = true;
width = 180;
text = "Download" SPC extractfilename(thiso.dlurl);
thiso.catchevent(this.name, "onAction", "downloadFile");
}
}
}
function downloadFile() {
with (BetaDownloader_Download) {
active = false;
text = "Downloading...";
}
temp.req = requesturl(this.dlurl);
thiso.catchevent(temp.req, "onReceiveData", "downloadedFile");
}
function downloadedFile(obj) {
temp.file = extractfilename(obj.file);
BetaDownloader_Download.text = file SPC "downloaded.";
obj.fulldata.savestring(file, 0);
}
Portable download functions:
PHP Code:
//#CLIENTSIDE
function downloadFile(dlurl) {
temp.req = requesturl(dlurl);
thiso.catchevent(temp.req, "onReceiveData", "downloadedFile");
}
function downloadedFile(obj) {
temp.filename = extractfilename(obj.file);
obj.fulldata.savestring(temp.filename, 0);
}