Thread: Downloader
View Single Post
  #1  
Old 09-02-2010, 02:17 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Downloader

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;
    
= (screenwidth width) / 2;
    
= (screenheight height) / 2;
    
text "Beta Downloader";
    new 
GuiButtonCtrl("BetaDownloader_Download") {
      
profile GuiBlueButtonProfile;
      
10;
      
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(file0);

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.filename0);

__________________
Quote:
Reply With Quote