Thread: Scheduled task?
View Single Post
Old 08-Mar-2007, 10:41 PM   #2 (permalink)
Anilrgowda
Administrator
 
Anilrgowda's Avatar

Posts: 18,715
Join Date: Jan 2006
Rep Power: 10 Anilrgowda is on a distinguished road

IM:
Default Re: Scheduled task?

Then this version should do it...if it works, the Dim objShell..and objOutput.WriteLine... lines can be removed...


Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objShell: Set objShell = CreateObject("wscript.Shell")
Dim objFile: Set objFile = objFSO.OpenTextFile("C:\schedule.txt")
Dim objOutput: Set objOutpu=objFSO.CreateTextFile("C:\SchedResults.tx t")
x = 0
Do While Not objFile.AtEndOfStream
x = x + 1
strTime = objFile.ReadLine
strNewTime = FormatDateTime(DateAdd("n", -15, strTime), 4) & ":00"
strPresentation = "C:\Path to File\present.ppt"
strTask = "powerpnt /s " & strPresentation
objOutput.WriteLine "schtasks /create /ru system /sc once /st " & strNewTime & " /tn Present" & x & " /tr " & Chr(34) & strTask & Chr(34)
objShell.Run "schtasks /create /ru USERNAME /rp PASSWORD /sc once /st " & strNewTime & " /tn Present" & x & " /tr " & Chr(34) & strTask & Chr(34)
Loop
objFile.Close
objOutput.Close
Set objFile=Nothing
Set objShell=Nothing
Set objFSO=Nothing
Anilrgowda is offline   Reply With Quote