Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PILOTER les Tâches planifiées de Windows
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01243409
Message ID:
01243585
Vues:
26
Cela dépend ce que vous entendez par piloter. Voici un example commetn démarrer une tâche planifiée sans avoir a attendre que l'heure cédulé arrive.
 && Rouler une tache planifiée immediatement, au lieu d'attrendre qu'elle parte au temps spécifié.

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


>Bonjour à Tous,
>
>Je voudrais piloter les Tâches planifiées de windows à partir de VFP.
>
>Cordialement
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform