? ScheduleTask('Notepad.exe', '', , , .t.) ? ScheduleTask('Notepad.exe', '', , , .t., .t., 0x0, 0x80000) ? ScheduleTask('Notepad.exe', '', , , .t., .t., 0x1 + 0x10, 0x80000) function ScheduleTaks lparameters tcProgram, tcComputer, ttWhen, tcTimeZone, tlInteractive, tlRunRepeatedly, tnDaysOfWeek, tnDaysOfMonth local lcProgram, lcComputer, ltWhen, lcTimeZone, llInteractive, llRunRepeatedly, lnDaysOfWeek, lnDaysOfMonth local loService, lnJobId, lnResult, lcBias, lnBias, loTimeZone lcProgram = Iif(Vartype(tcProgram) = 'C', Alltrim(tcProgram), '') lcComputer = Iif(Vartype(tcComputer) = 'C' and not Empty(tcComputer), Alltrim(tcComputer), '.') ltWhen = Iif(Vartype(ttWhen) = 'T', ttWhen, Datetime() + 60) lcTimeZone = Iif(Vartype(tcTimeZone) = 'C' and not Empty(tcTimeZone), Alltrim(tcTimeZone), 'Pacific Standard Time') && Standard Time Zone to use llRunRepeatedly = Vartype(tlRunRepeatedly) = 'L' and tlRunRepeatedly lnDaysOfWeek = Iif(Vartype(tnDaysOfWeek) = 'N', tnDaysOfWeek, 0) lnDaysOfMonth = Iif(Vartype(tnDaysOfMonth) = 'N', tnDaysOfMonth, 0) if Empty(lcProgram) && or not File(lcProgram) return 0 endif lnJobId = 0 loLocator = CreateObject("wbemScripting.SwbemLocator") loService = loLocator.ConnectServer(lcComputer) * * Note that for scheduling tasks in a remote machine appropriate permissions are required * But I am assuming in this demo you are scheduling to your local machine or you are a Domain admin * Retrieve the computer's current TimeZone Bias lnBias = GetCurrentBias() lcBias = Iif(Sign(lnBias) = 1, '+', '-') + Transform(Abs(lnBias), '@L 999') loScheduledJob = loService.Get("Win32_ScheduledJob") lnResult = loScheduledJob.Create(lcProgram, Ttoc(ltWhen, 1) + ".000000" + lcBias, llRunRepeatedly, lnDaysOfWeek, lnDaysOfMonth, tlInteractive, @lnJobId ) * Confirming that the job has been scheduled at the right time loScheduledJob = loService.Get("Win32_ScheduledJob.JobID=" + Alltrim(Str(lnJobID))) ? lnResult, loScheduledJob.StartTime * To delete a job * loScheduleJob.Delete_ return lnJobId ************************** function getCurrentBias(ttCurrent as Datetime) local loLocator, loService, loTimeZones, loTimeZone, loCurrentTimeZone, ltStandard, ltDayLight, ltCurrent, lnCurrentBias loLocator = createObject("wbemScripting.SwbemLocator") loService = loLocator.ConnectServer() loTimeZones = loService.ExecQuery("Select * from Win32_TimeZone") ltCurrent = Iif(Vartype(ttCurrent) # 'T', Datetime(), ttCurrent) for each loTimeZone in loTimeZones loCurrentTimeZone = loTimeZone && The collection has only one item, the fake loop is to get it, for it does not work directly endfor with loCurrentTimeZone ltStandard = FindNday(.StandardDayOfWeek + 1, .StandardDay, .StandardMonth, , .t., .StandardHour, .StandardMinute, .StandardSecond) ltDayLight = FindNday(.DayLightDayOfWeek + 1, .DayLightDay, .DayLightMonth, , .t., .DayLightHour, .DayLightMinute, .DayLightSecond) lnCurrentBias = .Bias - Iif(Between(ltCurrent, Min(ltStandard, ltDayLight), Max(ltStandard, ltDayLight)), .DayLightBias, .StandardBias) endwith return lnCurrentBias **************************** * Description : This function returns the nth occurrence of a day of week * * within a given month and year. * * Returns : (D) The date which its day of the week is the nth day within * * the month, or empty if no such day exist. * * Notes : Ex: * * - findnday(3, 2, 7, 1999)={07/14/99} The second wednsday of * * july '99 * **************************** function FindNDay(tnDOW, tnOrder, tnMonth, tnYear, tlDateTime, tnHours, tnMinutes, tnSeconds) * Parameters verification. if vartype(tnDOW) <> "N" or not Between(tnDow, 0, 6) return {} endif if vartype(tnOrder) <> "N" return {} endif local i, lnDOW, lnOrder, lnMonth, lnYear, ldStartDate, lnHours, lnMinutes, lnSeconds, lxReturn, lnStartDow lnMonth = iif(vartype(tnMonth) <> "N", month(date()), tnMonth) lnYear = iif(vartype(tnYear) <> "N", year(date()), tnYear) lnHours = iif(vartype(tnHours) <> "N" or not Between(tnHours, 0, 23), 0, tnHours) lnMinutes = iif(vartype(tnMinutes) <> "N" or not Between(tnMinutes, 0, 59), 0, tnMinutes) lnSeconds = iif(vartype(tnSeconds) <> "N" or not Between(tnSeconds, 0, 59), 0, tnSeconds) lxReturn = Iif(tlDateTime, {/:}, {}) * End of parameters verification. * First find the 1st day of the month if tnOrder < 0 or tnOrder > 5 return lxReturn endif lnStartDOW = Dow(date(lnYear, lnMonth, 1)) ldStartDate = date(lnYear, lnMonth, 1) + tnDow - lnStartDOW + (tnOrder - Iif(tnDow >= lnStartDow, 1, 0)) * 7 if month(ldStartDate) = lnMonth lxReturn = Iif(tlDateTime, Datetime(Year(ldStartDate), Month(ldStartDate), Day(ldStartDate), lnHours, lnMinutes, lnSeconds), ldStartDate) endif return lxReturnYou can see that to get the rigth bias I juggled a lot, but I could not find a way of doing in any other way, for the class does not return the current bias (for the date and time applying the Daylight Savings) thus all the extra code, and I do not even know if it will work in any case, it works in my computer thou, do not know about other settings <g>