#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0

    Question Python opening a program


    I am trying to open a program with Python and then extract data.

    I got the program to open with os.startfile , but to fully open it, I need to click "ok". Does anyone know the code for clicking the ok button?

    Thanks,
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,996
    Rep Power
    481
    For assistance, you'll need to explain your question with more detail. I do not know what is os.startfile, and neither does my python installation.
    Code:
    >>> import os
    >>> help(os.startfile)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'startfile'
    >>>
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    80
    Rep Power
    3
    Originally Posted by swimgirl320
    I am trying to open a program with Python and then extract data.

    I got the program to open with os.startfile , but to fully open it, I need to click "ok". Does anyone know the code for clicking the ok button?
    Thanks,
    What type of file is it? There may or may not be a "Code for clicking the ok button" depending on what exactly it is you're doing.

    Is it an executable? Where does the necessity arise to use Python to open it?

    (Just some background)

    Originally Posted by b49P23TIvg
    For assistance, you'll need to explain your question with more detail. I do not know what is os.startfile, and neither does my python installation.
    Code:
    >>> import os
    >>> help(os.startfile)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'startfile'
    >>>
    My guess? Win32. You said you didn't help with that stuff. :P
    Remember, os is an OS-specific module. If I understand correctly.

    Code:
    Python 2.7.5 Stackless 3.1b3 060516 (default, May 21 2013, 17:59:42) [MSC v.1500 32 bit (Intel)] on win32
    Type "copyright", "credits" or "license()" for more information.
    >>> import os
    >>> help(os.startfile)
    Help on built-in function startfile in module nt:
    
    startfile(...)
        startfile(filepath [, operation]) - Start a file with its associated
        application.
        
        When "operation" is not specified or "open", this acts like
        double-clicking the file in Explorer, or giving the file name as an
        argument to the DOS "start" command: the file is opened with whatever
        application (if any) its extension is associated.
        When another "operation" is given, it specifies what should be done with
        the file.  A typical operation is "print".
        
        startfile returns as soon as the associated application is launched.
        There is no option to wait for the application to close, and no way
        to retrieve the application's exit status.
        
        The filepath is relative to the current directory.  If you want to use
        an absolute path, make sure the first character is not a slash ("/");
        the underlying Win32 ShellExecute function doesn't work if it is.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0
    The code is as follows

    import os
    button = os.startfile('C:\Program Files (x86)\Quorum Business Solutions\PROD\Land Suite - QLS Desktop Application - 6.0\QUpdater.exe')

    This code opens the program Quorum, but a part of the opening process is that you have to click ok. I am trying to automate that process so that I can run the code and have the program open and then extract data.

    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo