Solved

calling a process (external) in a loop

Posted on 2009-07-14
4
160 Views
Last Modified: 2013-12-17
Hello group,

I've started writing a code in C# and there is a step that I have to read a directory full of PDF and convert them to Text (using an open source). In fact, I am calling a process within a loop.

I'm worry that would cause issue sometimes or ... any idea or advice will be appreciated.

Regards,

in the loop:
 
{
                    Process p = new Process();
 
                    p.StartInfo.UseShellExecute = false;
                    p.StartInfo.RedirectStandardInput = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.FileName = "C:\\test\\pdftotext.exe";
                    p.StartInfo.Arguments =  strPDFIn + " " + strTestOut;
                    p.Start();
 
  }

Open in new window

0
Comment
Question by:akohan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24859585
What kind of "advice" do you need?  What kind of problems do you foresee?  Do you need to wait for the process to complete before moving on to the next process?  Does each process work on its own .pdf file and output?
0
 

Author Comment

by:akohan
ID: 25170969


Yes, I need to know how I can make it wait to process 1 gets complete.

Regards,
ak
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 25172659
You can use something like this:

p.WaitForExit();

    -- or --

p.WaitForExit(10000);    // Timeout after 10 seconds.
0
 

Author Comment

by:akohan
ID: 25173792


Thanks.
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 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