PDA

View Full Version : Mulitple download source folders


jhum
04-20-2005, 02:54 PM
Is there a way that a series of document files can be downloaded from multiple folders?

For example:

Is it possible to have the updated files downloaded from two different folders such as:
"www.yourdomain.com/patches/folder1/subfolder1"
and
"www.yourdomain.com/patches/folder2/subfolder2"

If so, how do I go about setting this up in the server script?

Thanks,
jhum

Mark
04-20-2005, 04:01 PM
Hi jhum,

TrueUpdate 2.0 has a built-in screen that makes accomplishing this very easy, the screen is called: "Download Multiple Files" and it comes in three varieties: HTTP, FTP, and LAN.

The way to use this screen is to add it to your Server Screens list and then configure the On Preload event the screen to "know" about all of the files that you want to download. You do this by configuring and adding more entries into the screen globals file table. It is actually much easier then it sounds.

Basically each entry in the screen globals file table is a file that will be downloaded. Each entry has the following settings, which are pretty self-explanatory:

SourceURL = "http://www.yoursite.com/yourfile1.exe",
DestinationPath = "C:\\My Downloads\\yourfile1.exe",
Port = 80,
Timeout = 30,
UseBasicAuth = false,
AuthUsername = "Username",
AuthPassword = "Password",
UseSSL = false,
TransferType = MODE_BINARY

For the most part you will probably only have to configure: SourceURL, DestinationPath, AuthUsername, and AuthPassword. Once you take a look at the screen you should be able to figure out how to configure it to suit your needs.

After that simply call the screen from either your Server script or your Client script, you will probably want to add the “Download File Failed” screen after your “Download Multiple Files” to catch and stray errors.

Hope this helps!

jhum
05-30-2005, 12:55 PM
Hi Mark,

I am using the 'Download Multiple Files' screen with the HTTP option. However, I don't quite get how I configure the 'On Preload' script so that it is configured to download files from two different folders on a web server. I would like to have files downloaded from two different source URLs:

"http://www.mycompany.com/patches/application1"
"http://www.mycompany.com/patches/application2"

Where and how do I add another SourceURL Folder by modifying the code below:

-- Where do you want to download all document files from?
g_SourceURLFolder = "www.mycompany.com/patches";
g_HTTPTimeout = 30;
g_HTTPPort = 80; -- if using HTTPS, the port must be 443
g_HTTPUseBasicAuth = false;
g_HTTPAuthUsername = "";
g_HTTPAuthPassword = "";
g_HTTPUseSSL = false; -- set to true if using HTTPS
g_HTTPTransferType = MODE_BINARY;

-- What temporary folder do you want to download all document files to?
g_DocFileDownloadFolder = SessionVar.Expand("%TempFolder%\\Patch");

-- Set up a table for all document files.
g_tableFiles = {};

-- Set up the list of files to install
g_tableFiles[1] = { SourceFilename = "data.xml",
DestinationPath = SessionVar.Expand("%SourceFolder%\\..\\..\\content\\data.xml"),
Overwrite = FILE_INSTALL_OLDER,
CreateBackup = false,
SharedSystem = false};

g_tableFiles[2] = { SourceFilename = "homePage.swf",
DestinationPath = SessionVar.Expand("%SourceFolder%\\..\\homePage.swf"),
Overwrite = FILE_INSTALL_OLDER,
CreateBackup = false,
SharedSystem = false};

Please advise

Mark
05-31-2005, 08:47 AM
Hi jhum,

It's difficult for me to tell how to modify the code that you posted since that code is not the default code for the Download Multiple Files HTTP screen, and I do not know how any of it is handled outside of the On Preload script.

I'm also a bit confused about what you actually want to do, when you say download files from different folders, do you mean that you are trying to download the same files from two possible locations? Or that you are downloading different files that will exist in different folders?

Using the default Download Multiple Files HTTP screen you might try something similar to the following, I have highlighted the important parts in red:


-- These actions are performed before the screen is shown.

-- Set up a table for this screen's global variables
-- so we don't accidentally modify any global variables that are used elsewhere
screen_globals = {};

-- Should the screen abort if any single file download fails?
screen_globals.AbortOnFirstFailedDownload = true;

-- Should the screen only return SR_SUCCESS if *ALL*
-- of the files are downloaded successfully? (If false,
-- the screen will consider it an overall success
-- if any single file in the list is downloaded)
screen_globals.RequireAllFilesForSuccess = true;

-- Set up a table for the list of files to download
screen_globals.tableFiles = {};

-- Set up the list of files to download
screen_globals.tableFiles[1] = { SourceURL = "http://www.mycompany.com/patches/application1/data.xml",
DestinationPath = SessionVar.Expand("%TempFolder%\\Patches\\application1\\data.xml"),
Port = 80,
Timeout = 30,
UseBasicAuth = false,
AuthUsername = "Username",
AuthPassword = "Password",
UseSSL = false,
TransferType = MODE_BINARY };

screen_globals.tableFiles[2] = { SourceURL = "http://www.mycompany.com/patches/application1/homePage.swf",
DestinationPath = SessionVar.Expand("%TempFolder%\\Patches\\application1\\homePage.swf"),
Port = 80,
Timeout = 30,
UseBasicAuth = false,
AuthUsername = "Username",
AuthPassword = "Password",
UseSSL = false,
TransferType = MODE_BINARY };

screen_globals.tableFiles[3] = { SourceURL = "http://www.mycompany.com/patches/application2/data.xml",
DestinationPath = SessionVar.Expand("%TempFolder%\\Patches\\application2\\data.xml"),
Port = 80,
Timeout = 30,
UseBasicAuth = false,
AuthUsername = "Username",
AuthPassword = "Password",
UseSSL = false,
TransferType = MODE_BINARY };

screen_globals.tableFiles[4] = { SourceURL = "http://www.mycompany.com/patches/application2/homePage.swf",
DestinationPath = SessionVar.Expand("%TempFolder%\\Patches\\application2\\homePage.swf"),
Port = 80,
Timeout = 30,
UseBasicAuth = false,
AuthUsername = "Username",
AuthPassword = "Password",
UseSSL = false,
TransferType = MODE_BINARY };