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

I have a list of memberID numbers to look up in an application's database. I want to read the memberID's from a db or a file and interact with this other application in a macro style. Here's the pseudo code of what I'm trying to accomplish
#!/pseudo -w use pseudostrict; use DBI; my $dbh = DBI->connect('dbi:ODBC:DB',$login,$pass); my $query = q{SELECT MemberID FROM UnfinishedRequests WITH (NOLOCK)}; my $sth = $dbh->prepare($query); $sth->execute(); while(my @row = $sth->fetchrow_arrayref) { #Copy the MemberID to the clipboard #Swap to make the db app the active app #Paste the MemberID into the other app's query box #A Dialog box pops up on the other app if there is not a hit for +that MemberID. I want to be able to tell if that box is present... i +f it is not record it in my database as a hit.. other wise not found. } $dbh->disconnect();
I didn't even know what to search for on CPAN. Anyone have any ideas on how to get me started?

Grygonos

Replies are listed 'Best First'.
Re: Logical Macro w/ Perl
by CountZero (Bishop) on Dec 23, 2003 at 22:21 UTC
    What OS are you using? If you are on Windows, perhaps the Win32::* modules (esp. Win32::OLE and its brethren) might come in handy. Or perhaps the "other" application exposes an API you can tap into. Or maybe it has a command line interface hidden away somewhere?

    If you are not on a version of Windows, I have no idea what to answer, but surely other Monks will jump in and help you.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Logical Macro w/ Perl
by maa (Pilgrim) on Dec 24, 2003 at 14:48 UTC
    Hi,
    as has already been noted it's not possible to tell exactly what you're after however I've done stuff like this in MS Office apps before - it's not always straightforward to automate a Select-Copy-SwitchApp-Paste operation even within standard Office apps...

    Assuming one of the apps is a MS Office app you should hit ALT+F11 and create a new module in the VBA IDE then figure out what you want to do with Application.SendKeys (using the Windows help to get the special characters for ALT/Ctrl etc) then, once you know what you want to do (doesn't really have to be quite working) try converting it to Perl (if that's the best solution)...

    'This is VBA in Excel Dim thisBook as Workbook 'need to add ref in Tools/References Dim otherApp as Word.Application Set otherApp = GetObject("Work.Application") otherApp.Activate 'Send the keystrokes... Application.SendKeys "keystrokes"
    and in Perl
    use strict; use Win32::OLE; my $WordApp = Win32::OLE->GetActiveObject("Word.Application"); #blah blah

    HTH - Mark

      Sorry for not being more specific. It is not a Win32::OLE kind of issue. This is a Java app that my company has access to. The provider of the information and the app has things down pretty tight. you can't copy/select any data out of the application. I don't have access to the Java source either because It's accessed via the net and only after logging into their system can going through some clicks can I even open the app.


      Grygonos