Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Windows Task Scheduler
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01023677
Message ID:
01024094
Vues:
18
Hi Mike

Doesnt seem to be a point where I could add new tasks through here. I wonder why they stopped short?

Thanks anyway
Geoff

>Here is an example of how to run a task in the task scheduler now, rather than waiting for it to hit the scheduled time:
>
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
>
>>Hi
>>
>>Can someone please tell me the class id (COM) name of the Windows task scheduler.
>>
>>Thanks in advance
>>Geoff Scott
May all your weeds be wildflowers
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform