Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

defining executables

rossK
2007-01-19
2013-05-28
  • rossK
    rossK
    2007-01-19

    If I have an application that is launched using an executable shared by several programs and further defined by *.ini files is there a way for me to define this in python?  Not sure if that's clear or not, but it would be cool if I could define the app such as:  runme.exe + db.ini + base.ini.

    I haven't read through all the documentation to see if this is possible or not, so I thought I'd post here and see what kind of reply I could get.

     
    • Mark Mc Mahon
      Mark Mc Mahon
      2007-01-19

      Hi Ross,

      I am not 100% sure that I do understand.

      First of all - when you say Python - I guess you mean pywinauto?

      pywinauto knows nothing of how the application works (DB/INI/etc) it only knows about windows (and processes to a small extent). So if you start your app one time with runme.exe db.ini base.ini, then pywinauto will just see the process. If you stat runme with some other parameters - then pywinauto will connect to just THAT process (and both could be running at the same time without conflict)

      I think if you need different pywinauto scripts for each application (runme + different parameters) then it is up to you to remember which script is needed for which parameter.

      e.g.
      automate_runme_db_base.py would be for DB.ini + Base.ini
      automate_runme_file_derived.py would be for file.ini + derived.ini

      Again - I may be completely off the mark on what you were asking?

      -Mark

       
    • rossK
      rossK
      2007-01-19

      Yes, I meant pywinauto, not python. 

      My inquiry comes from looking at the tutorial and how certain apps are used calling the *.exe that defines them.  In the example provided with the pywinauto tutorial, I start notepad by calling notepad.exe:

      >>> from pywinauto import application
      >>> app = application.Application.start("notepad.exe")
      >>> app.notepad.TypeKeys("%FX")

      If I have an app that has multiple parameters would I just copy the target into where I'm defining the app, like:

      >>> from pywinauto import application
      >>> app = application.Application.start("runme.exe c:\runme\lib\db.ini -pf c:\runme\bin\base.ini -x")
      >>> app.runme.TypeKeys("User 1")

       
      • Mark Mc Mahon
        Mark Mc Mahon
        2007-01-19

        Hi Ross,

        I just tested very briefly with Notepad - and it works, that said I haven't tested extensively.

        My gut feeling is that it should work for you.

        Application.start() just passes the string it receives to CreateProcess() windows API function. And doesn't have separate parameters for options - they are all passed in one string.

        Thanks
           Mark