Announcement

Collapse
No announcement yet.

Read URL From File !?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read URL From File !?

    HEllo Every One.

    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 ~= nilthen
      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 minmax do
       
    local cellText Grid.GetCellText("Grid1"count0);
        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"falsefalse);
    Grid.SetFrameFocusCell("Grid1"falsefalse);


    Grid.ExpandLastColumn("Grid1"true);
    Grid.SetCellText("Grid1"00"SessionID"false);
    Grid.SetCellText("Grid1"01"Speed"false);
    Grid.SetCellText("Grid1"02"Elapsed Time"false);
    Grid.SetCellText("Grid1"03"Total"false);
    Grid.SetCellText("Grid1"04"Downloaded"false);
    Grid.SetCellText("Grid1"05"Percent"false);
    Grid.SetCellText("Grid1"06"Status"false);
    end


    function Download.OnProgress(tblData)
       
     if ( 
    tblData ~= nilthen
       
       
    if (tblData.Data == "DialogEx1"then
         
         Progress
    .SetCurrentPos("Progress1"tblData.Percent);
         
    local strinfo string.format("Downloading .. %s / %s  - Speed : %d Kb/s",String.GetFormattedSize(tblData.LoadedFMTSIZE_AUTOMATICtrue),String.GetFormattedSize(tblData.TotalFMTSIZE_AUTOMATICtrue), 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.LoadedFMTSIZE_AUTOMATICtrue),String.GetFormattedSize(tblData.TotalFMTSIZE_AUTOMATICtrue), tblData.CurrentSpeed);
         
    Label.SetText("Label3"strinfo);
         
         
          
    local nRow FindRow(tblData.Session);
          if(
    nRow 0then
      
          Grid
    .SetCellText("Grid1"nRow1tblData.CurrentSpeed.." KB/S"true);
          
    Grid.SetCellText("Grid1"nRow2tblData.TimeElapsed.." Seconds"true);
          
    Grid.SetCellText("Grid1"nRow3String.GetFormattedSize(tblData.TotalFMTSIZE_AUTOMATICtrue), true);
          
    Grid.SetCellText("Grid1"nRow4String.GetFormattedSize(tblData.LoadedFMTSIZE_AUTOMATICtrue), true);
          
    Grid.SetCellText("Grid1"nRow5"% "..tblData.Percenttrue);
     
          
    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 0then
      
            Grid
    .SetCellText("Grid1"nRow6"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 0then
      
       Grid
    .SetCellText("Grid1"nRow1"0 KB/S"true);
       
    Grid.SetCellText("Grid1"nRow2"0 Seconds"true);
       
    Grid.SetCellText("Grid1"nRow3"0 KB"true);
       
    Grid.SetCellText("Grid1"nRow4"0 KB"true);
       
    Grid.SetCellText("Grid1"nRow5"% 0"true);
       
    Grid.SetCellText("Grid1"nRow6"Error Occured"true);
       
       
      
    end
    end
    end 
    thankx

  • #2
    Hello.
    How Can I Set Download Plugin to Load "URL and Destination folder" from File ?

    For Example :

    url.txt :

    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"

    dest.txt:

    tblDestFiles[1] = _TempFolder .. "\\em015x.zip"
    tblDestFiles[2] = _TempFolder .. "\\em015x.zip"
    tblDestFiles[3] = _TempFolder .. "\\em020x.zip"
    tblDestFiles[4] = _TempFolder .. "\\em011x.zip"


    PHP Code:
        tblURL = {}
        
    url TextFile.ReadToString("AutoPlay\\Docs\\url.txt");

        
    tblDestFiles = {}
        
    dest TextFile.ReadToString("AutoPlay\\Docs\\dest.txt");

        
    session Download.Start(Application.GetWndHandle(), tblURL[count], tblDestFiles[count], """"falsetblProxy0"some text""another some text"); 


    but this code not work :(

    Comment

    Working...
    X