Solved

Problem with Loop

Posted on 2007-11-19
4
421 Views
Last Modified: 2010-04-21
Hi all,

I am using WebCopy from TMS to download a list of images which is populated in a listbox.

So, I've done a loop but it's not downloading all of them. The loop is skiping items.

What's wrong with my code please?

Here it is:

var i: integer;
begin
for i:=0 to listbox1.Count-1 do

  begin
  WebCopy1.Items.Add.Protocol := wpHTTP;
  WebCopy1.Items.Add.FileDate := EncodeDate(2002,3,18);
  WebCopy1.Items.Add.CopyNewerOnly := false;
  WebCopy1.Items.Add.TargetDir := 'c:\1temp';
  WebCopy1.Items.Add.URL := (listbox1.Items.Strings[i]);

  end;

WebCopy1.Execute;
end;

Hope you can help!

Thanks

ST3VO
0
Comment
Question by:ST3VO
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 20312615
set a breakpoint and debug, we need more information
0
 
LVL 28

Expert Comment

by:2266180
ID: 20314022
I would say the problem is not in the loop.

can you check if the problem happens only with selected files and always with them? (remove some items from listbox (items that are copied) If this is happening, then you need to somehow get the info back from tms web copy which sould include the http response for each item.

also, I suppose you have sufficient space on your harddrive.

I also suppose that the items from the listbox are correct urls (do not contain invalid characters, etc).

but first, we need to know if the problem is with some specific files or it's random, in which case we need to look at tms webcopy.

if you can make that webcopy to throw/log some errors, it would be almost perfect. I myself never worked with that so I don't know the internals, but I am sure that we can help you out provided you give us some more details as merijnb suggested.
0
 

Author Comment

by:ST3VO
ID: 20318593
OK....I'll see what I can come up with!
0
 

Author Closing Comment

by:ST3VO
ID: 31409934
Thanks....I sorted it out!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 62
FMX enumerated colours 2 84
Making delphi communicate with a c# service 16 88
Press three keys together and trigger a function 3 50
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now