Method to run bat file as a separate thread

Questions, tips and tricks and techniques for scripting in Servoy

Method to run bat file as a separate thread

Postby Westy » Thu Jun 04, 2009 6:31 pm

On a test server, after running a method that exports data from our Servoy solution to Acrobat form data format (FDF) files, we call a Windows bat file that:

Creates a PDF file populated with data for each FDF file
Combines resulting PDF files into one PDF file
Creates Bookmarks in the resulting PDF file for each page in the file
Zips the resulting file

A method within Servoy then e-mails the zipped file to our user. It all works great except that the process takes a long time when there are a large number of PDF files (ie. 500 files).

We call the bat file using:

application.executeProgramInBackground('rundll32', 'url.dll,FileProtocolHandler', path + 'Convert.bat');

The bat file opens the console and executes perfectly every time. However, we are not able to call the bat file again to process another job until the first process is completed. How can we call the bat file from within Servoy so that it will run in a separate thread each time it is called? We are running 2003 Server.

Is there a maximum recommended time for an external process to run on a server? The described process can take over a minute, which seems dangerous.

Dean Westover
Choices Software, Inc.
Westy
 
Posts: 852
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA

Re: Method to run bat file as a separate thread

Postby IT2Be » Thu Jun 04, 2009 10:10 pm

If I am not mistaken you don't run the bat file in Java but from/in your system.
I am no that familiar with Windows but I don't think you can run more than one instance of a bat file.
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Re: Method to run bat file as a separate thread

Postby Harjo » Thu Jun 04, 2009 10:46 pm

Westy, I think this can be perfectly done with Servoy (and 3th party plugins, pdf Pro plugin, It2be tools plugin, for zip etc.. etc.)
than you have total control about the process.

just a thought.....
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Method to run bat file as a separate thread

Postby Westy » Sat Jun 06, 2009 4:22 am

Thank you for your comments. Because of the time required to run the described process it looks like we are going to move it from the server to the client.

Dean
Westy
 
Posts: 852
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA


Return to Methods

Who is online

Users browsing this forum: No registered users and 35 guests

cron