Results 1 to 4 of 4

Thread: File Help

  1. #1
    Join Date
    Feb 2007
    Location
    Toronto, Ontario, Canada
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default File Help

    Hey all, I was making a simple youtube downloader, but I can't figure out how to get the string to save to a file. I keep getting strange access violations, etc.
    SCAR Code:
    program New;
    var
      c, i : integer;
      s : string;
    const
      url = 'http://www.youtube.com/watch?v=RIQWsPJPHYY';
      loc = 'C:\myfile.txt';
    begin
      i := GetSystemTime;
      c := InitializeHTTPClient(true, true);
      SetHTTPUserAgent(c, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20');
      Status('Resolving link, standby...');
      s := GetHTTPPage(c, url);
      s := 'http://www.youtube.com/get_video?video_id='+Between('video_id=','&',s)+'&t='+Between('&t=','&',s)+'&el=detailpage&ps';
      Status('Resolved link, downloading...');
      s := GetHTTPPage(c, s);
      writeln(s);
      FreeHTTPClient(c);
      Status('Download complete, copying...');
      c := OpenFile(loc, false);
      WriteFileString(c, s);
      i := GetSystemTime - i;
      //CloseFile(c);
      s := 'Saved succesfully to '+loc+', took '+IntToStr(i)+'ms, ';
      i := FileSize(c);
      s := s + 'downloaded '+IntToStr(i) + 'bytes.';
      Writeln(s);

    end.

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    save the script somewhere and then run it.

    might work

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    Sep 2008
    Location
    SWEDEN
    Posts
    363
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Why make when you can get a free here?

  4. #4
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it worked for me but didn't save file?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need help with log file.
    By l33t_h4x0r in forum OSR Help
    Replies: 2
    Last Post: 10-10-2007, 11:49 AM
  2. sig from file
    By skibby in forum Semi Stupid Pictures
    Replies: 6
    Last Post: 05-26-2007, 04:28 AM
  3. End of file
    By botmaster in forum OSR Help
    Replies: 3
    Last Post: 11-09-2006, 05:47 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
  •