Perl System Call on Windows

I have a perl script on Windows that automates Sorensen Squeeze, an encoding program. It calls Squeeze via the command line, Squeeze encodes the file, quits, and the perl script continues.

Occasionally I get a video that Squeeze cannot encode, which causes a prompt to come up saying "Unsupported file" with an OK button. Because its automated, it halts the script until someone manually goes on the server and hits the OK button.

Any ideas how I can detect this is happening so I can force the application to terminate so that my queued videos don't get delayed waiting on someone to press OK.

Thanks
Mark
d1tvAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mjcoyneCommented:
Can't seem to find a manual for this software.  Are there command line switches you can use to disable the dialog window and have it quit more gracefully?  Failing that, can you test the file's type in Perl before calling Squeeze, and bypass it if it's not compatible?
0
d1tvAuthor Commented:
No, there is no switch to disable this according to the Squeeze manual (although I have contacted them to see if there is anything I can do to prevent it).  I do a test beforehand, but every once in a while Squeeze might fail for another reason, or it may pass the test but the file could be corrupt somehow. So I'm really looking for a way to see if something fails which would bring the dialog box up.

Is there any way to grab the ouput from the call and detect such a prompt?
0
mjcoyneCommented:
"Is there any way to grab the ouput from the call and detect such a prompt?"

Well, yes -- unless the output is a GUI dialog box (which. BTW, has no business being generated by a command line call to a program).  I don't know of a way to deal with such an outcome from Perl (doesn't mean there isn't one; just that I'm unaware of one).

Can you tell if the program has failed due to time elapsed?  It's not a perfect solution, but if 99.9 percent of the time a successful program run concludes in say 10 minutes, if the program is still running 15 minutes after launch, can you assume failure?

If so, you could perhaps get the program's process ID (using something like http://www.roth.net/perl/scripts/scripts.asp?WMI_PS.pl) and then kill it using this PID (e.g. http://www.roth.net/perl/scripts/scripts.asp?WMI_Kill.pl) after a suitable amount of time had passed.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Adam314Commented:
I'm assuming this program is running on a windows computer (posted in the windows 2003 TA).  If so, there are some functions in the Win32 set of modules that can help you interact with GUI applications.

For this, it sounds like the Win32::GuiTest module might help:
    http://search.cpan.org/~karasik/Win32-GuiTest-1.54/lib/Win32/GuiTest.pm

You could use the FindWindowLike function to see if there is a dialog from the squeeze program.  If so, you could use the SendKeys function to send pressing the enter button (which should close the dialog the same as clicking OK).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.