import time
import subprocess

#TweetDeck
a=15
print "Opening TweetDeck...\n"
while a>=0:
    print (str(a)+" seconds remaining...")
    time.sleep(5)
    a-=5
subprocess.call("C:\Program Files\TweetDeck\TweetDeck.exe")

#Rest period
print ("\nWaiting...")
time.sleep(5)

#Firefox
a=15
print "\nOpening Mozilla Firefox...\n"
while a>=0:
    print (str(a)+" seconds remaining...")
    time.sleep(5)
    a-=5
subprocess.call("C:\Program Files\Mozilla Firefox\firefox.exe")

Hey guys,

I used the above code to open programs(TweetDeck and Firefox).
What I want to do is, make it read a text file, where I can list all the program I want to open. And I know how to do this, but;
how do I run the program at startup(any other way than dragging and dropping it in the Start menu>Startup?).

The problem is: after TweetDeck opens, FF doesn't open until I close TweetDeck? Any ideas why?

Thanks

When you call an executable from the command line, it waits until it closes (finishes executing) to move on. For example if you had a batch file like this:

Firefox.exe
IExplorer.exe

It would open Firefox, and then if you closed Firefox it would open Internet Explorer.

I'm not sure of an exact way to get around this but the general answer is that you have to dive a little deeper into the subprocess module, which is not super fun. Also, you might want to take a look at batch file behavior, and figure out how to start a program and then move on.

Sounds like it should. I'm DEFINETLY the wrong person to ask about threading though, maybe somebody else could chime in...

This question has already been answered. Start a new discussion instead.