Steven Matthews
Steven Matthews

Reputation: 11285

Launching two processes at once

Ok, so I want to have a script that will run an install process. One of the parts of this is installing Microsoft Office products. I want to launch a Microsoft installer and then programmatically (currently using the Python library 'Pywinauto') insert keys and press buttons.

However, the program stops executing when it reaches the launch of the Office installer, and only resumes once it closes.

Is there anyway to have like, two separate "paths" the program takes, at the same time? Launch the Office installer and while that is still open, have another path insert the correct code into it?

EDIT: Here's some pseudocode, I figured it might end up being helpful.

if x == blah:
    Path 1:
    subprocess.call("installer.exe")
    Path 2 (at exactly the same moment):
    pywinautoify-insert serial key, clicky buttons
    Both end at the same time, merge back into standard program code

Upvotes: 0

Views: 101

Answers (1)

Matteo Italia
Matteo Italia

Reputation: 126787

If you just need to spawn a process without waiting for it you can simply use os.spawnl with the os.P_NOWAIT flag.

But the fundamental error is trying to automate an installation process in this way. Almost all installers (especially if they are installers for "big" products) allow silent, automated installation to simplify the life of system administrators. The usual switch for silent installs is /q or -q, and you often can specify the settings for the installation in some way (with a special configuration file or with an MSI transform, for example).

In particular, for Office 2007 and 2010 you can read here and here.

Upvotes: 1

Related Questions