Sign in to follow this  
Followers 0
ctl

Start a program at a specified time

14 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



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:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

 

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"

 

 ?

Share this post


Link to post
Share on other sites

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


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  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

Share this post


Link to post
Share on other sites

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


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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
1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

Yep.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0