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

I was using Win32::GuiTest to automate a process I was doing manually. The script I was writing would open the application, navigate the menus, enter the data, and capture the text for me to get the results. It worked fine.

But then I needed to add a Tk interface to make it a little easier and user friendly for other people to use. For some reason, though, when I moved my program into a sub, that I had assigned as a command on a Tk Button, when it used the system("start foo.exe", foo.exe would freeze on it's start-up splash screen until the entire keypress routine was finished. As soon as the routine finished, boom, it would load up.

Without Tk, the program worked fine. It would call the program, the program would start, and it would press the right buttons. But when I bound it all inside Tk, suddenly the program decided it didn't really want to start until the routine was completely done it's Keypress routine.

Any ideas why this is happening, and how to get around it?

Replies are listed 'Best First'.
Re: Tk Stopped a working program
by PodMaster (Abbot) on Apr 16, 2003 at 15:30 UTC
    What?
    decided it didn't really want to start until the routine was completely done it's Keypress routine.
    So you have a tkapp with a button which when clicked invokes sub Bar?
    Sub Bar does a system("start foo.exe") and runs a bunch of Win32::GuiTest code?
    If that's the case, it's not likely to play well with Tk because your tkapp will be blocked until the subroutine returns (it's how it works ).

    What you wanna do instead is system("start perl testFoo.pl") right after you system("start foo.exe")

    or

    put instructions into a an array called @BBAR, use Tk::after, and setup a callback which would iterate of @BBAR and ineffect be guitesting foo.exe.

    You might also wanna checkout HWXperl - The place for GUI apps in Perl (http://sourceforge.net/projects/hwx).


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Thank you for your advice. Running the two system calls, first to foo.exe, and then to the other perl script, worked like a charm, and allows the rest of my Tk code to function while letting the foo.exe do it's stuff correctly. Thank you, Podmaster :)
Re: Tk Stopped a working program
by Mr. Muskrat (Canon) on Apr 16, 2003 at 13:26 UTC
    I use Win32::GUITest all the time to automate different things and I'd love to help. Can you post the code you are using so that we can see what went wrong?