2
votes

Based on this info, what automation tools / libraries / scripting languages do you suggest?

  • I have a C++ / C# backround
  • I have a Python future
  • I use Windows, but would very much prefer a multi-platform solution for sharing purposes

How would I use those Tool(s), Language(s), or Library(s) to do the following?

  • Pass input / data between minimized, inactive windows without interfering with whatever the user might be doing in the foreground.

  • Search for / Act on relevant controls and data inside an inactive window

  • Interact with an applications GUI while its minimized (GUI controls' screen coordinates are unknown)

  • Perform HTTP requests / automatic logins or form submitions.

  • Perform logic

Here's an example problem I'm trying to solve:

I have a program I call "Member Extractor" that extracts my site's member's contact information through the web; although the program can only be controlled through its GUI; and doesn't have the ability to export the data yet. (so each piece of information such as Email, Phone #, etc. must be automatically and systematically copied to the clip board 1-by-1, and pasted into a new "Microsoft Excel" document).

Once the information is copied and saved in an organized way, I need to import that data to multiple new "Contact Profiles" generated by the "Universal Contact Manager" extension of the "Google Chrome Web Browser." The ordering of the data in the excel document isn't certain; so some kind of search for the cell location of the column header needs to be preformed along with some logic.


1
Is "Member Extractor"'s GUI a browser-based one? If so then the answer is browser based automation, and I think greasemonkey would be the answer and that would allow you to have cross-platform solution.user266647

1 Answers

1
votes

One way to do this is using the WScript.Shell object. You can automate the copying and pasting by running the programs with WshShell.Run then scripting the GUI with WshShell.SendKeys which allows you to send any key combinations you normally can with your keyboard. So you can script any application you can use with your keyboard. The other good news is you can use the Windows Scripting engine with any language that has an OLE interface including Python. Here's an (untested) example:

import sys
import win32api
import win32com.client

shell = win32com.client.Dispatch("WScript.Shell")
shell.Run("notepad " + sys.argv[0])
shell.SendKeys("{Enter}{Enter} You should see the script code in notepad")

Try copying this code into a *.py file and running it like any other Python code. You'll need the win32api package this comes by default with Active Python (ActiveState's Python distribution). You can find this here: http://www.activestate.com/activepython (it's free and open-source), you'd want version 2.7.

You could also use the OLE interface to create and manipulate the Excel spreadsheet. A general discussion of Python and OLE can be found here: How do I script an OLE component using Python?

Here a few links that may be of use:

P.S. At least for the first part, it may be easier long term and would definitely be less brittle to modify the application to dump the data (if that's an option). But the OLE automation should work if that's the best option.