Highlighted
Absent Member.
Absent Member.
303 views

[archive] Scheduling Jobs

[Migrated content. Thread originally posted on 11 January 2007]

Hello,
Is it possible to write a menu program that schedules other programs to be run later? (overnight, for example)

Thanks!!
0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Scheduling Jobs

What OS are you on?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Scheduling Jobs

Windows XP
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Scheduling Jobs

You can use the "at" command or edit the cron on UNIX but on Windows you have to click Start-All programs-Accessories-System Tools-Scheduled tasks.
Hope that helps.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Scheduling Jobs

I do know of a website that has some VB code that schedules tasks. But I don't know if it works. I'm sure you can set it up to execute from a menu option or a push button:

http://techtasks.com/code/viewbookcode/368

Here's the code:
' From the book "Windows XP Cookbook"
' ISBN: 0596007256

' This code schedules a task to run every Sunday at 1:30AM.

const MON = 1
const TUE = 2
const WED = 4
const THU = 8
const FRI = 16
const SAT = 32
const SUN = 64

' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strCommand = "c:\perl\bin\perl.exe c:\scripts\diskchecker.pl"
strStartTime = "********013000.000000-240" ' 01:30 EDT
'YYYYMMDDHHMMSS.MMMMMM-/+TZO
boolRepeat = TRUE ' Repeat the task periodically
intWeekDay = SUN ' Repeat task every Sunday
intMonthDay = "" ' Set this if you want the task to repeat monthly
boolInteract = FALSE ' Do not interact with the desktop
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "")
set objNewTask = objWMI.Get("Win32_ScheduledJob")
intRC = objNewTask.Create(strCommand, _
strstartTime, _
boolRepeat, _
intWeekDay, _
intMonthDay, _
boolInteract, _
intJobID)
if intRC <> 0 then
Wscript.Echo "Error creating task: " & intRC
else
WScript.Echo "Successfully scheduled task."
WScript.Echo "JobID: " & intJobID
end if
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Scheduling Jobs

You can use the "at" command or edit the cron on UNIX but on Windows you have to click Start-All programs-Accessories-System Tools-Scheduled tasks.
Hope that helps.

Windows has an "at" command that will put tasks in Scheduled Tasks.

There are also Windows API calls that will created items in Scheduled Tasks. The API calls give some more flexibility.

In the past, I've written "task" records to a Cobol file, then had a program run at night that read the file and called the appropriate programs to execute the tasks.

The program that reads the file and does the calls can be started in a variety of ways. One way it to create a Windows Scheduled task to run it at a certain time.

Another way is to hunt around for a program called SRVANY, which allows you to turn any program into a Windows service. My program would run through SRVANY and would sleep and wake up at an appropriate time and read the task file and execute any tasks that had been written to it.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.