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

Hello,

I'm currently opening a file using

 my $status = system($file);

This opens the file in the program that it's created in. Inside that program's window is the files window. I need to access a tab of that window. Then copy a value in a table on that tab. Also I can't access the file without the program it's encrypted.

I don't want to name the program, but a good analogy would opening an excel file using system. Accessing the second tab of the file and reading E12 cell.

My background is in EE and I'm PERL beginner. I don't know what to do after the files been opened. If there is a CPAN Module that can read objects or manipulate them. Any help would be appreciated.

Update 8/15/2014: I built the program using the Win32:GUITest module (It was a lot of reading and learning). It's been able to grab the value I needed. It runs through a loop and renames multiple files. I need to add some WaitWindow() calls and value verification checks to make it a little bit more robust. All in all though it works and I'm quite happy with it. Thank you for your responses.

Replies are listed 'Best First'.
Re: reading a value out of a program
by roboticus (Chancellor) on Jul 18, 2014 at 16:11 UTC

    State Space:

    Assuming you're on a Windows box, I'd try looking at driving the program with Win32::GUITest for interacting with the program. If you're running a different OS/windowing system, there are probably similar methods available.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Re: reading a value out of a program
by CountZero (Bishop) on Jul 18, 2014 at 15:29 UTC
    The answer can be "yes", no" or "perhaps". There is just not enough information to work with. Many programs have an API which allows you to access certain functions of that program. Many MS programs running under the Windows OS can be accessed through the Win32::OLE module. A good start to look around would be to search on CPAN if there is any module with the name of your program.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
Re: reading a value out of a program
by PerlSufi (Friar) on Jul 18, 2014 at 15:29 UTC
      PerlSufi,

      Read, think and then write.

      The OP mentioned an Excel file as an analogy, so it is not really useful to direct him to the documentation of Spreadsheet::ParseExcel.

      He also said that the file is encrypted, so opening the file with the standard Perl open function is not likely to yield much success, is it?

      As your name indicates, you are a seeker of (Perl) wisdom, so meditate some more and mend your errors.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics