954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Time Lapse

0
By Sravan R on Jul 30th, 2009 2:08 pm

The user enters the full location of a file and the program determines whether the file is a sound file or an application and opens it after a user specified time.

Example:
Location: C:\Where ever\file.mp3
OR
C:\Another Where Ever\prog.exe
TIme(in mins): 10

import time
import subprocess

loc=raw_input("Enter the full location: ")
t=(input("Time(in minutes): "))*60
print t

def prog():
    l=len(loc)
    ext=loc[l-3:l]
    if(ext=="exe"):
        time.sleep(t)
        subprocess.call(loc)
    elif(ext=="mp3"):
        time.sleep(t)
        subprocess.call(["C:\Program Files\Windows Media PLayer\mplayer2.exe",loc])

prog()

NOTE: In line 16, replace the location of the media player I have entered with the location where the media player is installed in your computer.

sravan953
Posting Whiz in Training
243 posts since May 2009
Reputation Points: 2
Solved Threads: 30
 

HINT: You can also use this as an alarm! Just enter the location of a sound file and the time after which you want the alarm.

sravan953
Posting Whiz in Training
243 posts since May 2009
Reputation Points: 2
Solved Threads: 30
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: