Announcement

Collapse
No announcement yet.

AuthData

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

  • AuthData

    Hello.
    I Used Download Plugins and I Have 2 Input for get user name and password (input1 , input2)
    i want to add 'AuthData' to this script :
    like this :

    Code:
    HTTP.Download("http://www.test.com/test1.jpg", _TempFolder.."\\00\\test1.jpg", MODE_BINARY, 60, 80, {UserName=input1,Password=input2}, nil, HTTPCallback);

    how can add 'AuthData' to this script :

    Code:
    function Download.OnProgress(tblData)
       
      if ( tblData ~= nil) then
      LastOffset =  tblData.Loaded*1024
      end
    
    end
    
    
    DialogExsession = 0;
    
    tblURL = {}
    
    tblURL[1] = "http://www.test.com/test1.jpg"
    tblURL[2] = "http://www.test.com/test2.jpg"
    tblURL[3] = "http://www.test.com/test3.jpg"
    tblURL[4] = "http://www.test.com/test4.jpg"
    
    
    tblDestFiles = {}
    
    tblDestFiles[1] = _SourceFolder.."\\AutoPlay\\Docs\\test1.jpg"
    tblDestFiles[2] = _SourceFolder.."\\AutoPlay\\Docs\\test2.jpg"
    tblDestFiles[3] = _SourceFolder.."\\AutoPlay\\Docs\\test3.jpg"
    tblDestFiles[4] = _SourceFolder.."\\AutoPlay\\Docs\\test4.jpg"
    
    
    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
     
          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
Working...
X