Member Avatar for sravan953
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.

Member Avatar for sravan953

Will threading help?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.