Hi
Ive written some code that basically creates a scheduled task on a load of remote machines.
This is the code that im using
now if I set it to run Notepad it all works fine but if I set it to open up a VB6 App Ive created it just comes up with "Could Not Start" in the schedule list? Now its finding the app as it is setting the Scheduled Items Icon to the Apps Icon but it just won't run!Code:Dim strTime As String Dim strDate() As String Dim vntWeek() As Variant Dim intCounter As Integer Dim intWeekCounter As Integer Dim strdyz As String strdyz = "M,T,W,TH,F,S,SU" vntWeek = Array("M", "T", "W", "TH", "F", "S", "SU") With udtAtInfo ' Change the format of the time strTime = Format("00:10", "hh:mm") ' Change the time to one used by the api .JobTime = (Hour(strTime) * 3600 + Minute(strTime) * 60) * 1000 ' Set the Date parameters If Val(strdyz) > 0 Then ' Set the task to run on specific days of the month i.e. 9th & 22nd of the month strDate = Split(strdyz, ",") For intCounter = 0 To UBound(strDate) .DaysOfMonth = .DaysOfMonth + 2 ^ (strDate(intCounter) - 1) Next Else ' Set the task to run on sepecific days of the week i.e. Monday & Thursday strDate = Split(strdyz, ",") For intCounter = 0 To UBound(strDate) For intWeekCounter = 0 To UBound(vntWeek) If UCase(strDate(intCounter)) = vntWeek(intWeekCounter) Then .DaysOfWeek = .DaysOfWeek + 2 ^ intWeekCounter Exit For End If Next Next End If ' Set the interactive property 'If Check1.Value = vbUnchecked Then .Flags = .Flags Or JOB_NONINTERACTIVE 'End If ' Set to run periodically 'If Option2.Value = True Then .Flags = .Flags Or JOB_RUN_PERIODICALLY 'End If ' Set the command to run .Command = StrConv("MyApp.exe", vbUnicode) End With
Am I missing something really stupid on this one?


Reply With Quote

