Home » Questions » Computers [ Ask a new question ]

Windows app that waits specified amount of time then launches specified app?

Windows app that waits specified amount of time then launches specified app?

I know this could probably be done somewhat easily in something like AutoHotkey, but is there an app you could do this with?

Asked by: Guest | Views: 321
Total answers/comments: 2
Guest [Entry]

"You can use the built in at command and specify a time:

at 7:30 /interactive notepad.exe

more geared to StackOverflow, but I just wrote a quick Python script that will utilize the at command and make the time conversions for you, it can be compiled to an executable with py2exe:

import sys,os,time

if len(sys.argv) != 3:
print ""Invalid number of arguments supplied""
print ""Usage: runwait.py <path_to_file> <time_in_seconds>\n""
print ""Example: runwait.py C:\Runme.exe 12000""
sys.exit(-1)

wait = time.time()+float(sys.argv[2])
futuretime = time.localtime(wait)
formatted = time.strftime(""%H:%M"",futuretime)
execstr = ""at"",formatted,""/interactive"",sys.argv[1]
os.system(' '.join(execstr))

example of use as shown in the script:

runwait.py C:\Runme.exe 12000

that will run the specified file in 12000 seconds (200 minutes/3 hours and 20 mins)

What the script does is basically grabs the current time, converts it to epoch time, adds the amount of seconds you specified back to that, converts the time back to something the at utility will accept, and adds it as a job."
Guest [Entry]

"There is a sleep utility for batch files free for download:

http://malektips.com/xp_dos_0002.html

It has been suggested that you take advantage of ping to get the result that you want.
Why not combine that suggestion, and the sleep command/utility from the site above?"