Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 15 of 15
  1. #1
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    74

    Download textfiles from Webserver

    Hi,

    i want to download textfiles from a webserver. to download a textfile you need to select a day, month and year with 3 comboboxes on the webpage.
    normaly there is one textfile for each day of the month. for some days there is no file to download.

    my question now, is it possible to send that information to the webpage and download all files of a month one by one and save them in a folder sorted by year and month.

    byte

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Quote Originally Posted by Byte
    my question now, is it possible to send that information to the webpage and download all files of a month one by one and save them in a folder sorted by year and month.

    byte
    The bigger question is whether or not the web page allows you to construct a URL that contains that information so you can specify it in the download portion of an HTTP action.

    http://yoursite.com/downloads/downlo...dd=2&yyyy=2005

    Then yes it shouldn't be that difficult.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    74
    hi TJ_Tigger,

    yes the page allows that. but if i enter something like this

    permanenzen.php4?tid=1&tag_tag=02&tag_mon=01&tag_j ahr=2005

    it doesn't download the file, but displaying the file in a html format.
    is there a command to download, that i can add to the url?

    byte

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Take a look at this thread, it might help

    http://www.indigorose.com/forums/sho...t=download+dll

  5. #5
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Hard to say, can you code something into your site to allow for downloading wihin the URL? Have you tried HTTP.Download to try and download using that URL? Is it an ascii file or binary file? You might be able to use LuaCOM to access the text.

    Without knowing the site and how it works it is hard to help with specifics.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  6. #6
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    74
    @Worm
    the sourcecode doesn't help me, i need the textfile.

    @TJ_Tigger
    the page is not my page, so i can't change anything on it.
    the page provides textfiles which can be downloaded by selecting a day, mont and year. by clicking on download, it downloads that textfile.
    i thought it could be done by passing the varibales. here is the link to that page, maybe you can figure something out.

    http://www.spielbank-hamburg.de/spie...rmanenzen.php4

    byte

  7. #7
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Hard to say. I can play with it, but I am not a Web person I have very limited knowledge on HTML and PHP. Have you contacted the owner of the site to see if there is a way for you to script the ability to obtain these files from an external program?

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  8. #8
    Join Date
    Jan 2000
    Posts
    2,002
    I think what you want to do then is an HTTP.Submit action something like this:

    Code:
    tblValues = {tid="1",tag_tag="02",tag_mon="01",tag_jahr="2005"};
    
    strReturn = HTTP.Submit("http://YOURURL.COM/permanenzen.php4",tblValues,SUBMITWEB_GET);
    local nLastError = Application.GetLastError();
    if(nLastError == 0)then
    	-- Everything was successful...
    	Dialog.Message("Success",strReturn);
    	
    	-- You can now write strReturn out to a text file if you want...
    	TextFile.WriteFromString("C:\\Textfile.txt",strReturn);
    else
    	Dialog.Message("Error",_tblErrorMessages[nLastError]);
    end

  9. #9
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Use the sample app I posted here...

    http://www.indigorose.com/forums/sho...49&postcount=2

    In the Input Box, use the following as the source to the doc. Take out the _RemoveThis_
    Code:
    _RemoveThis_http://www.spielbank-hamburg.de/spielsaal/permanenzen.php4?tid=1&tag_tag=02&tag_mon=01&tag_jahr=2005&download.x=15&download.y=14

  10. #10
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    74
    hi worm,

    that works perfect. how did you figure that out?

    byte

  11. #11
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Took a wild guess that the PHP script was looking for a passed parameter from the image you clicked on to determine whether to download, or display the information. When I added "download.x" to the passed parameters, it worked.

    I tried using the built in actions of AMS, but I couldn't used "download.x" as a associative name in a table, so it wouldn't work. That doesn't mean its not possible, just I couldn't do it in the 5 minutes I tried, and the DLL worked, so...

  12. #12
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    74
    hi worm,

    if i enter that adress directly into my browser adressfield, it opens the save filebox and asks for the place to save the file and downloads that textfile.

    is it possible to do the same thing within AMS without asking where to save the file. instead give a folder in AMS where to save it.

    byte

  13. #13
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    you could try something like this...
    Code:
    tid="1"
    tag_tag="02"
    tag_mon="11"
    tag_jahr="2005"
    
    sTXT = GetUrlSrc("http://www.spielbank-hamburg.de/spielsaal/permanenzen.php4?tid="..tid.."&tag_tag="..tag_tag.."&tag_mon="..tag_mon.."&tag_jahr="..tag_jahr.."&download.x=15&download.y=15");
    sTXT = String.Replace(sTXT,"\r", "")
    sTXT = String.Replace(sTXT,"\n", "\r\n")
    sFolder = Dialog.FolderBrowse("Folder to Save to...", _DesktopFolder)
    if sFolder ~= "CANCEL" then
    	TextFile.WriteFromString(sFolder.."\\"..tag_jahr..tag_mon..tag_tag.."_"..tid..".txt", sTXT, false)
    else
    	Dialog.Message("File Save", "The file was not saved.")
    end

  14. #14
    Join Date
    Jun 2005
    Location
    Germany
    Posts
    74
    thanks for your help,

    this is what i did so far. works perfect.

    Code:
    Table_selected = ComboBox.GetSelected("CB_Tisch");
    stable = ComboBox.GetItemData("CB_Tisch", Table_selected);
    
    Month_selected = ComboBox.GetSelected("CB_Monat");
    smonth = ComboBox.GetItemData("CB_Monat", Month_selected);
    tmonth = ComboBox.GetItemText("CB_Monat", Month_selected);
    
    Year_selected = ComboBox.GetSelected("CB_Jahr");
    syear = ComboBox.GetItemData("CB_Jahr", Year_selected);
    
    FolderYear = Folder.DoesExist(_SourceFolder.."\\Perm original\\"..syear);
    if FolderYear == false then
       Folder.Create(_SourceFolder.."\\Perm original\\"..syear);
    end
    
    FolderMonth = Folder.DoesExist(_SourceFolder.."\\Perm original\\"..syear.."\\"..tmonth);
    if FolderMonth == false then
       Folder.Create(_SourceFolder.."\\Perm original\\"..syear.."\\"..tmonth);
    end
    
    FolderTable = Folder.DoesExist(_SourceFolder.."\\Perm original\\"..syear.."\\"..tmonth.."\\Tisch "..stable);
    if FolderTable == false then
       Folder.Create(_SourceFolder.."\\Perm original\\"..syear.."\\"..tmonth.."\\Tisch "..stable);
    end
    
    --Progressbar initialisieren
    EndProgress = 31;
    Progress.SetRange("Status", 0, EndProgress);
    Progress.SetCurrentPos("Status", 0);
    Progress.SetStep("Status", 1);
    Progress.SetVisible("Status", true);
    
    for i = 1, 31, 1 do
      Progress.StepIt("Status");
      sTXT = GetUrlSrc("http://www.spielbank-hamburg.de/spielsaal/permanenzen.php4?tid="..stable.."&tag_tag="..i.."&tag_mon="..smonth.."&tag_jahr="..syear.."&download.x=15&download.y=14");
      sTXT = String.Replace(sTXT,"\r", "");
      sTXT = String.Replace(sTXT,"\n", "\r\n");
      TextFile.WriteFromString(_SourceFolder.."\\Perm original\\"..syear.."\\"..tmonth.."\\Tisch "..stable.."\\"..syear..smonth.."0"..i.."_"..stable..".txt", sTXT, false);
    end
    
    Progress.SetVisible("Status", false);
    byte

  15. #15
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Cool biz!

Similar Threads

  1. Screen: Download File Progress
    By Brett in forum Setup Factory 8.0 Examples
    Replies: 13
    Last Post: 01-13-2007, 09:24 PM
  2. Bug? Http download error not recorded by GetHTTPErrorInfo()
    By Ken Gartner in forum TrueUpdate 2.0
    Replies: 1
    Last Post: 03-16-2005, 07:56 AM
  3. HOWTO: Download and Install Files from the Web
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-23-2002, 01:16 PM
  4. HTTP download problem
    By skameni in forum Setup Factory 6.0
    Replies: 3
    Last Post: 09-12-2002, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts