Programme pour piloter un logiciel

Signaler
Messages postés
1
Date d'inscription
jeudi 15 avril 2004
Statut
Membre
Dernière intervention
15 avril 2004
-
Messages postés
224
Date d'inscription
vendredi 14 septembre 2001
Statut
Membre
Dernière intervention
14 juillet 2006
-
Bjr,

Je suis un peu novice dans le monde obscur mais fascinant de la programmation. Aussi je souhaiterais savoir s'il existe un programme, logiciel o uidéalement un bout de code permettant de "piloter" un logiciel c-ad- lui faire exécuter une séquence d'actions correpondant à une séquence de touches claviers ...
Merci de votre aide.

Prefab Sprout

1 réponse

Messages postés
224
Date d'inscription
vendredi 14 septembre 2001
Statut
Membre
Dernière intervention
14 juillet 2006

Un truc du genre:

'File: defrag.vbs
'
'This script launches defrag and sends keys to the UI in order to automate the defrag
'process.

set WshShell = CreateObject("WScript.Shell")

'Launch Defrag from the command line and wait for a second
WshShell.Run "dfrg.msc"
WScript.Sleep 1000

'Wait until the application has loaded - Check every second
While WshShell.AppActivate("Disk Defragmenter") = FALSE
wscript.sleep 1000
Wend

'Bring the application to the foreground
WshShell.AppActivate "Disk Defragmenter"
WScript.Sleep 200

'Send an ALT-A key to bring down the degrag menu
WshShell.SendKeys "%A"
WScript.Sleep 200

'Send a D to start the defrag
WshShell.SendKeys "D"

'Wait until the defrag is completed - Check for window every 5 seconds
While WshShell.AppActivate("Defragmentation Complete") = FALSE
wscript.sleep 5000
Wend

'Bring the msgbox to the foreground
WshShell.AppActivate "Defragmentation Complete"
WScript.Sleep 200

'Send a tab key to move the focus from View Report button to the Close Button
WshShell.Sendkeys "{TAB}"
Wscript.Sleep 500

'Send key to Close the Defragmentation Complete window
WshShell.Sendkeys "{ENTER}"
Wscript.Sleep 500

'Send a tab key to move the focus to disk list
WshShell.Sendkeys "{TAB}"
Wscript.Sleep 500

'Send a down arrow to select next drive
WshShell.Sendkeys "{DOWN}"
Wscript.Sleep 500

'Send an ALT-A key to bring down the degrag menu
WshShell.SendKeys "%A"
WScript.Sleep 200

'Send a D to start the defrag
WshShell.SendKeys "D"

'Wait until the defrag is completed - Check for window every 5 seconds
While WshShell.AppActivate("Defragmentation Complete") = FALSE
wscript.sleep 5000
Wend

'Bring the msgbox to the foreground
WshShell.AppActivate "Defragmentation Complete"
WScript.Sleep 200

'Send a tab key to move the focus from View Report button to the Close Button
WshShell.Sendkeys "{TAB}"
Wscript.Sleep 500

'Send key to Close the Defragmentation Complete window
WshShell.Sendkeys "{ENTER}"
Wscript.Sleep 500

'Send and ALT-F4 to Close the Defrag program
WshShell.Sendkeys "%{F4}"