Jump to content

Start a program at a specified time


ctl
 Share

Go to solution Solved by water,

Recommended Posts

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
Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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"

 

 ?

Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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"

Link to comment
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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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.

Link to comment
Share on other sites

  • Solution

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:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
Link to comment
Share on other sites

Yep.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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