1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| Sub Utiliser_MSagent()
Dim Chemin As String
Dim ArrayAttitude As Variant
Dim j As Integer
Dim Ag As AgentObjects.Agent
Dim Personnage As AgentObjects.IAgentCtlCharacter
'Liste des attitudes
ArrayAttitude = Array("Alert", "Announce", "Blink", "Confused", "Congratulate", "Congratulate_2", _
"Decline", "DoMagic2", "DontRecognize", "Explain", "GestureDown", "GestureLeft", "GetAttention", _
"GetAttentionReturn", "Greet", "Idle1_1", "Idle1_2", "LookDown", "LookDownBlink", _
"LookDownReturn", "LookUp", "MoveDown", "Pleased", "Process", "Read", "ReadContinued", _
"ReadReturn", "RestPose", "Search", "StartListening", "StopListening", "Suggest", "Surprised", _
"Wave", "Write", "WriteContinued", "WriteReturn")
'Définit le fichier du personnage
Chemin = Environ("windir") & "\msagent\chars\merlin.acs"
Set Ag = New AgentObjects.Agent
Ag.Connected = True
Ag.Characters.Load "Merlin", Chemin
'&h409 anglais
'&H40C français
Ag.Characters("Merlin").LanguageID = &H409
Set Personnage = Ag.Characters("Merlin")
With Personnage
'Affichage
.Show
'Définit la largeur du personnage
.Width = 200
'Définit la hauteur
.Height = 200
End With
On Error Resume Next
For j = 0 To UBound(ArrayAttitude)
'Position à l'écran
'Personnage.MoveTo 50 * j, 25 * j
'Texte
Personnage.Speak ArrayAttitude(j)
'Attitude
Personnage.Play ArrayAttitude(j)
'Pause: 3 secondes
Application.Wait (TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 3))
Next j
On Error GoTo 0
Personnage.Speak "\Chr=""Whisper""\Au revoir! " & Environ("username")
'Pause: 3 secondes
Application.Wait (TimeSerial(Hour(Now()), Minute(Now()), Second(Now()) + 3))
Set Personnage = Nothing
Set Ag = Nothing
End Sub |
Partager