Click here to Skip to main content
16,019,154 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
Hi all,

I am developing a console application using C# to automate Print Job for a bulk of documents. Below I am mentioning my plan for developing and my approach.

Algorithm:

1)Fetch list of documents.
2)Process the document list one by one.
a)Launch the Application.
b)Wait till the application launched perfectly.
c)Fire the Print Job.
d)Wait for Print dialog appear.
e)Fire "ENTER" key press event.
f)Wait till spooling finish.
g)Close the document and application.
3)Update the XML with Print job info.


Code:
C#
//Launch the file from the location specified in.
White.Core.Application application =White.Core.Application.Launch(@path);

Console.WriteLine("launch is done");

Thread.Sleep(3000);//Wait till Application Launched successfully.

//Sending Commands to Print(to press "Ctrl+P" button).
SendKeys.SendWait("^(p)");

Thread.Sleep(3000);//Wait till Print Dialog appear 

//Sending Commands to Print(to press "Enter" Button).
SendKeys.SendWait("{ENTER}");

//Get the current time as the document fired for print job.
_printedTime = DateTime.Now;

Thread.Sleep(3000);//Wait till spooling Finish.

//Closing the window.
SendKeys.SendWait("%{F4}");


Now the problem is for waiting case I am blindly using Thread.Sleep(With Few seconds), which is not Ideal. So I need to know How I'll fix these issues using White Framework in C#.

Can anybody help me to fix this issue please. Any help will be appreciated.
Thanks in advance
Posted
Updated 4-Aug-11 20:11pm

1 solution

Have you tried the documentation? White Framework - Job Automation[^]
 
Share this answer
 
Comments
Basnta Padhi 8-Aug-11 9:27am    
I posted the same question in White Framework blog for my question but I did not get any solution yet.
Dave Kreskowiak 8-Aug-11 9:57am    
What makes you think the people here have ever used the White Framework?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900