Results 1 to 12 of 12

Thread: [RESOLVED] Save in a loop

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    376

    Resolved [RESOLVED] Save in a loop

    Hi I am trying to save about 3000 gif's inside of a loop, it would really save time if I could make the code to do this rather than save each one by one. These pictures all have numbers for example the location of the first picture is http://www.pictures/file/0001.gif (not really but you get the idea). They go up to approx 3000.gif. The only thing on each page is that picture by itself. I want to start a loop at 0001.gif and increment it all the way up to 3000.gif and save each gif iside the loop. Wow even as I type this I'm thinking it may not be possible. Anyway If anyone has seen anything like this could you let me know. No sense starting something I cant finish. Thanks.

  2. #2

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    376

    Re: Save in a loop

    They are on a server that I dont have access to, I only have access to the web page they are posted on, So I could go to each page and right click on the pic and choose save as but that is tedious.

  4. #4
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959

    Re: Save in a loop

    Have a look at the Inet control.

    VB Code:
    1. Inet1.OpenURL([URL], [Data Type])

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    376

    Re: Save in a loop

    What do i need to include for that control?

  6. #6

  7. #7
    Lively Member MET777's Avatar
    Join Date
    Apr 2005
    Posts
    76

    Re: Save in a loop

    heres some great code i got somewhere...
    VB Code:
    1. bytes() = Inet1.OpenURL("internet URL", icByteArray)
    2.                 fnum = FreeFile
    3.             Open "filename" For Binary Access Write As #fnum
    4.                 Put #fnum, , bytes()
    5.             Close #fnum
    --Matt

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    376

    Re: Save in a loop

    what type is bytes()?

  9. #9

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    376

    Re: Save in a loop

    Ok, I guess now my problem is actually writing it to my file. I've created a file geoff.gif on my desktop and use this code:
    VB Code:
    1. Private Sub Form_Load()
    2. Inet1_StateChanged (State)
    3. End Sub
    4.  
    5. Private Sub Inet1_StateChanged(ByVal State As Integer)
    6. Dim bytes() As Byte
    7.  
    8. bytes() = Inet1.OpenURL("http://www.thefishfinder.com/images/worlds1.gif", icByteArray)
    9.                 fnum = FreeFile
    10.             Open "geoff.gif" For Binary Access Write As #fnum
    11.                 Put #fnum, , bytes()
    12.             Close #fnum
    13. End Sub

    How do I get it to write to geoff.gif? I've never done anything like this before so I may be going about it wrong.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2005
    Posts
    376

    Re: Save in a loop

    O nevermid it's working, I was looking in the wrong spot for the file. Thanks everyone.

  12. #12

Posting Permissions

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



Click Here to Expand Forum to Full Width