Time Lapse

sravan953 0 Tallied Votes 281 Views Share

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

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.

Member Avatar for sravan953
sravan953

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.

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.