Jump to content

Start a program at a specified time


Go to solution Solved by water,

Recommended Posts

Posted (edited)

Hello again guys, I have question, could someone help me with a code that start a program at a specified time ?

Let me give you an example at what I want

I have the program "myprogram.exe" I whant this program to start at 12:00, 15:00, 17:00, 19:00 is it possible to make a program which verifies the time from my pc and start the program at a time that I specified into the program ? Thanks in advance.

Edited by ctl
Posted

Windows / DOS comes with a simple command to let you do what you want: AT

AT 12:00 "command to execute"

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
  On 10/10/2013 at 6:31 AM, water said:

 

Windows / DOS comes with a simple command to let you do what you want: AT

AT 12:00 "command to execute"

 

So you suggest that I should creat a *.bat file with the command this command ? In the *.bat file I could give multiple command like

At 12:00 "command to execute"
At 15:00 "command to execute"

 

 ?

Posted

Or use the "Run" function to execute this DOS commands.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted (edited)

Ok, I have tested this command

at 09:38 start myprogram.exe

But no result, I just get the message "added a new job with job ID = 1" and when the time comes nothing happens, why ?

When I just write the command "start myprogram.exe" it works fine.

PS: I have run cmd with administrators rights.

Edited by ctl
Posted

I don't think "start" is needed. And I think you need to add the full path to your program.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

I try to add the path to my program but still the same thing, nothing happens.

at 10:08 C:\Program Files (x86)\program\myprogram.exe

 

I still get the message "Added a neat job with job ID = 1"

Posted

ehmm... sorry to interrupt the party, but do you need to automate the scheduling of your program, or just schedule your program on your pc?

if it's just your pc, then what's wrong with Windows Scheduled Task feature?

if you need to deploy your scheduled program to multiple machines, then you're on the right track: just double-quote the path, and you should be ok. another option would be to create a scheduled task, and copy the .job file to the target pc along with your exe.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted
  On 10/10/2013 at 7:19 AM, orbs said:

ehmm... sorry to interrupt the party, but do you need to automate the scheduling of your program, or just schedule your program on your pc?

if it's just your pc, then what's wrong with Windows Scheduled Task feature?

 

I want to schedule my program on my pc, I don't want to use the schelduled task because if I copy my program on another pc I have to activate the scheduled task.

All I need is a program that verify the time on my pc, and when the time is 12:00, 13:00, 15:00 etc, to start my program.

The program verify the clock hourly and when its 12:00 start my program, when its 13:00 start my program and so on.I need this kinda of program to have mobility to move the program wherever I want.

  • Solution
Posted

Or this one:

#include <Date.au3>
While 1
    $sTime = _NowTime(4)
    If $sTime = "12:00" Or $sTime = "15:00" Or $sTime = "17:00" Or $sTime = "19:00" Then
        MsgBox(0, "", $sTime)
    EndIf
    Sleep(1000 * 60) ; wait a minute
WEnd

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

So I have add a line befor then, please tell me if its correct. :D

#include <Date.au3>
While 1
    $sTime = _NowTime(4)
    If $sTime = "12:00" Or $sTime = "15:00" Or $sTime = "17:00" Or $sTime = "19:00" Then
    ShellExecute('D:\program\myprogram.exe')
        MsgBox(0, "", $sTime)
    EndIf
    Sleep(1000 * 60) ; wait a minute
WEnd
Posted

Before releasing the script remove the "MsgBox" line - it's only for debugging reasons ;)

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

#include <Date.au3>
While 1
    $sTime = _NowTime(4)
    If $sTime = "12:00" Or $sTime = "15:00" Or $sTime = "17:00" Or $sTime = "19:00" Then
    ShellExecute('D:\program\myprogram.exe')
    EndIf
    Sleep(1000 * 60) ; wait a minute
WEnd
Posted

Yep.

My UDFs and Tutorials:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...