ssfCONTROLS = 3 && Control Panel's Schedule Tasks folder >>sJobName = 'fta' && Name of the task to run >>sRunVerb = 'R&un' && Executing command >>sEndVerb = '&End Task' && Cancelling command >>shellApp = Createobject('shell.application') >>oControlPanel = shellApp.Namespace(ssfCONTROLS) && Schedule Tasks folder >>oST = ' >>For Each folderitem In oControlPanel.items && Loop though the items in the Control Panel items >> If folderitem.Name = 'Scheduled Tasks' >> oST = folderitem.getfolder() && Found it >> Exit >> Endif >>Next >>If Vartype(oST) != 'O' >> Messagebox('Couldn't find 'TS' folder') >>Endif >>oJob = ' >>For Each folderitem In oST.items && Loop through the different scheduled tasks until we fiind it. >> If Lower(folderitem.Name) = Lower(sJobName) >> oJob = folderitem && Found it >> Exit >> Endif >>Next >>If Vartype(oJob) !='O' >> Messagebox( 'Couldn't find ' + sJobName + ' item') >>Else >> bEnabled = .T. >> oRunVerb = ' >> oEndVerb = ' >> s = 'Verbs: ' + Chr(13) >> For Each Verb In oJob.verbs && Loop through the different commands in the scheduled task until we find right one. >> s = s + Chr(13) + Verb.Name >> If Verb.Name = sRunVerb >> oRunVerb = Verb >> bEnabled = .F. >> Endif >> If Verb.Name = sEndVerb >> oEndVerb = Verb >> Endif >> Next >> If bEnabled >> oJob.InvokeVerb(oEndVerb) && Cancel the task >> Else >> Wait Window Nowait 'executing job' >> oJob.InvokeVerb(sRunVerb) && Run the task! >> Endif >>Endif>>