PDA

View Full Version : Check to see if process is running


cschutte
03-01-2005, 05:43 PM
I'm admitting now that I'm new to Javascripting, and I'm trying to edit some existing JS code that was created by someone that knew what they were doing.

The problem that I am running into is that I have a process, PDFConvert.exe, that is initiated by a button click that takes info from different sources, combines it, and converts it to a PDF document.

The problem is that after the PDF is created PDFConvert.exe still runs for several seconds. This creates a problem if a user selects the button again, the process will error out and the pdf will not be created.

Is there a way to insert some JS code to check to see if PDFConvert.exe is running? And if it is running to wait x amount of seconds and try again, if it is still running to wait again?

liorean
03-01-2005, 08:18 PM
Well, if you want to do it from a homepage, the answer is no, you don't have that capability. It's possible that an ActiveX control could do it from JScript or the Windows Scripting Host, though.

codegoboom
03-01-2005, 09:44 PM
This creates a problem if a user selects the button again...

How about setting the button's disabled property to true at the top of the function, and false at the bottom?

cschutte
03-01-2005, 10:21 PM
Thanks for the reply, but disabling the button will not work. The problem is that the pdfconvert.exe thread is not robust enough to handle multiple request so I need to know if it is running. If it is I want to wait x amount of seconds then query to see if pdf.exe is running again.

The reason for that is that multiple users might be in their separate accounts trying to launch pdf.exe. So if user1 launches pdf.exe with their button and user2 tries to launch pdf.exe with his button 15 seconds later, I want something that will know that pdfconvert.exe is running and since it is running will wait x amount of seconds and try again.

Let me know what other info you need.

codegoboom
03-01-2005, 10:29 PM
WMI is the only way I know of... What type of application is the UI, and where is it being executed?

liorean
03-01-2005, 11:39 PM
Well, from the sounds of it, what you really need is some kind of spooler that can build a request que for it. That'd be something for the Computer Programming forum and not client side developement, though.