Blue_eyed_son has asked for the wisdom of the Perl Monks concerning the following question:

Hi--I have an annoying java application that I need to run many times to convert xml files. I would do the conversion itself in perl, but the files are extremely quirky, and this application was designed specifically to handle these files.
The application has three fields where I need to enter filenames of the input, xsl file, and output, and a button to execute the conversion.
Does anyone know how I can pass values to the application and run it? I've used Win32::Process to open it up, but haven't figued out what to do from there.
Thanks!
  • Comment on Using Perl to automate a java application

Replies are listed 'Best First'.
Re: Using Perl to automate a java application
by xdg (Monsignor) on Mar 02, 2007 at 03:22 UTC

    I'm speculating wildly here, so take this idea with a grain of salt, but you might be able to use Inline::Java to bypass the Java GUI application and just use Perl to call into the underlying Java classes that perform the data conversion. (Assumes you have access to the classes, know the API, etc.)

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Using Perl to automate a java application
by marto (Cardinal) on Mar 02, 2007 at 12:28 UTC
    As has been suggested you could use Win32::GuiTest to click buttons with the PushButton function and populate fields with known values via the SendKeys function. Check out the documentation, there are some short examples included in the distribution to get you started.

    Hope this helps

    Martin
      This is perfect! Thanks so much. Perl continues to be man's greatest achievement to date.
Re: Using Perl to automate a java application
by Anonymous Monk on Mar 02, 2007 at 04:40 UTC