HEllo Every One.
I Have Question :
How can i set Script to read "url and destination Folder" from txt or ini file ?
thankx
I Have Question :
How can i set Script to read "url and destination Folder" from txt or ini file ?
PHP Code:
function Download.OnProgress(tblData)
if ( tblData ~= nil) then
LastOffset = tblData.Loaded*1024
end
end
DialogExsession = 0;
---------------------------------------------------------
---------------------------------------------------------
tblURL = {}
tblURL[1] = "http://www.test.com/em015x.zip"
tblURL[2] = "http://www.test.com/em015x.zip"
tblURL[3] = "http://www.test.com/em020x.zip"
tblURL[4] = "http://www.test.com/em011x.zip"
tblDestFiles = {}
tblDestFiles[1] = _TempFolder .. "\\em015x.zip"
tblDestFiles[2] = _TempFolder .. "\\em015x.zip"
tblDestFiles[3] = _TempFolder .. "\\em020x.zip"
tblDestFiles[4] = _TempFolder .. "\\em011x.zip"
---------------------------------------------------------
---------------------------------------------------------
function FindRow(sesID)
local foundRow = 0;
local min = 1;
local max = Grid.GetRowCount("Grid1")-1;
for count = min, max do
local cellText = Grid.GetCellText("Grid1", count, 0);
if(cellText == tostring(sesID)) then
foundRow = count;
end
end
return foundRow;
end
function InitGrid()
Grid.SetListMode("Grid1", true);
Grid.SetFixedColumnSelection("Grid1", false);
Grid.SetSingleRowSelection("Grid1", true);
Grid.SetTrackFocusCell("Grid1", false, false);
Grid.SetFrameFocusCell("Grid1", false, false);
Grid.ExpandLastColumn("Grid1", true);
Grid.SetCellText("Grid1", 0, 0, "SessionID", false);
Grid.SetCellText("Grid1", 0, 1, "Speed", false);
Grid.SetCellText("Grid1", 0, 2, "Elapsed Time", false);
Grid.SetCellText("Grid1", 0, 3, "Total", false);
Grid.SetCellText("Grid1", 0, 4, "Downloaded", false);
Grid.SetCellText("Grid1", 0, 5, "Percent", false);
Grid.SetCellText("Grid1", 0, 6, "Status", false);
end
function Download.OnProgress(tblData)
if ( tblData ~= nil) then
if (tblData.Data == "DialogEx1") then
Progress.SetCurrentPos("Progress1", tblData.Percent);
local strinfo = string.format("Downloading .. %s / %s - Speed : %d Kb/s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true),String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), tblData.CurrentSpeed);
Label.SetText("Label1", strinfo);
else
Progress.SetCurrentPos("Progress1", tblData.Percent);
local strinfo = string.format("Downloading .. %s / %s - Speed : %d Kb/s",String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true),String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), tblData.CurrentSpeed);
Label.SetText("Label3", strinfo);
local nRow = FindRow(tblData.Session);
if(nRow > 0) then
Grid.SetCellText("Grid1", nRow, 1, tblData.CurrentSpeed.." KB/S", true);
Grid.SetCellText("Grid1", nRow, 2, tblData.TimeElapsed.." Seconds", true);
Grid.SetCellText("Grid1", nRow, 3, String.GetFormattedSize(tblData.Total, FMTSIZE_AUTOMATIC, true), true);
Grid.SetCellText("Grid1", nRow, 4, String.GetFormattedSize(tblData.Loaded, FMTSIZE_AUTOMATIC, true), true);
Grid.SetCellText("Grid1", nRow, 5, "% "..tblData.Percent, true);
end
end
end
end
function Download.OnComplete(tblData)
Download.Delete(tblData.Session);
if (tblData.Data == "DialogEx1") then
Label.SetText("Label1", "Completed..");
else
local nRow = FindRow(tblData.Session);
if(nRow > 0) then
Grid.SetCellText("Grid1", nRow, 6, "Completed", true);
end
end
end
function Download.OnError(tblData)
Download.Delete(tblData.Session);
if (tblData.Data == "DialogEx1") then
Label.SetText("Label1", "Error Occured..");
else
local nRow = FindRow(tblData.Session);
if(nRow > 0) then
Grid.SetCellText("Grid1", nRow, 1, "0 KB/S", true);
Grid.SetCellText("Grid1", nRow, 2, "0 Seconds", true);
Grid.SetCellText("Grid1", nRow, 3, "0 KB", true);
Grid.SetCellText("Grid1", nRow, 4, "0 KB", true);
Grid.SetCellText("Grid1", nRow, 5, "% 0", true);
Grid.SetCellText("Grid1", nRow, 6, "Error Occured", true);
end
end
end
Comment