Skip to main content

[archive] Scheduling Jobs

  • January 11, 2007
  • 5 replies
  • 0 views

[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!!

5 replies

[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!!
What OS are you on?

[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!!
Windows XP

[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!!
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.

[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!!
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

[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!!
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.