Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add Speech Recognize in Vfp
Message
 
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00908073
Message ID:
00908947
Views:
16
This message has been marked as the solution to the initial question of the thread.
Your OS?
Your OS SP?
Have you installed all OS fixes?
VFP version?
VFP SP?
Exactly what MS Agent files and which version you have installed?

Try next VFP8 SP1 code and see if you get it to work (like I have).
* Mode 2

SET DEFAULT TO HOME()+"samples\solution\FFC"

PUBLIC ofrmsolution1

SET CLASSLIB TO HOME()+'ffc\_agent.vcx' ADDITIVE
SET CLASSLIB TO HOME()+'ffc\_base.vcx' ADDITIVE

ofrmsolution1=NEWOBJECT("frmsolution1")
ofrmsolution1.Show
RETURN


**************************************************
*-- Form:         frmsolution1 (d:\program files\microsoft visual foxpro 8\samples\solution\ffc\agent.scx)
*-- ParentClass:  frmsolution (d:\program files\microsoft visual foxpro 8\samples\solution\solution.vcx)
*-- BaseClass:    form
*-- Time Stamp:   05/31/04 08:35:12 PM
*
DEFINE CLASS frmsolution1 AS form


	Height = 280
	Width = 343
	DoCreate = .T.
	Caption = "Working with Microsoft Agent"
	Name = "Frmsolution1"
	cAgent = "Merlin"

	ADD OBJECT _agent AS _agent WITH ;
		Top = 252, ;
		Left = 60, ;
		Height = 24, ;
		Width = 24, ;
		Name = "_agent"


	ADD OBJECT lbxanimations AS listbox WITH ;
		FontSize = 8, ;
		Height = 96, ;
		Left = 12, ;
		Sorted = .T., ;
		TabIndex = 6, ;
		Top = 96, ;
		Width = 120, ;
		ZOrderSet = 7, ;
		Name = "lbxAnimations"


	ADD OBJECT cmdplay AS commandbutton WITH ;
		Top = 96, ;
		Left = 144, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Play", ;
		TabIndex = 7, ;
		ZOrderSet = 8, ;
		Name = "cmdPlay"


	ADD OBJECT cmdstop AS commandbutton WITH ;
		Top = 120, ;
		Left = 144, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Stop", ;
		TabIndex = 8, ;
		ZOrderSet = 9, ;
		Name = "cmdStop"


	ADD OBJECT cmdpeedy AS commandbutton WITH ;
		Top = 120, ;
		Left = 264, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Peedy", ;
		TabIndex = 3, ;
		ZOrderSet = 10, ;
		Name = "cmdPeedy"


	ADD OBJECT cmdrobby AS commandbutton WITH ;
		Top = 96, ;
		Left = 264, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Robby", ;
		TabIndex = 2, ;
		ZOrderSet = 11, ;
		Name = "cmdRobby"


	ADD OBJECT cmdgenie AS commandbutton WITH ;
		Top = 168, ;
		Left = 264, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Genie", ;
		TabIndex = 5, ;
		ZOrderSet = 12, ;
		Name = "cmdGenie"


	ADD OBJECT cmdmerlin AS commandbutton WITH ;
		Top = 144, ;
		Left = 264, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Merlin", ;
		TabIndex = 4, ;
		ZOrderSet = 13, ;
		Name = "cmdMerlin"


	ADD OBJECT cmdshowtime AS commandbutton WITH ;
		Top = 168, ;
		Left = 144, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Showtime!", ;
		TabIndex = 9, ;
		ZOrderSet = 14, ;
		Name = "cmdShowTime"


	ADD OBJECT txtspeak AS textbox WITH ;
		FontSize = 8, ;
		Alignment = 3, ;
		Value = ("hello"), ;
		Height = 23, ;
		Left = 12, ;
		TabIndex = 10, ;
		Top = 204, ;
		Width = 240, ;
		ZOrderSet = 15, ;
		Name = "txtSpeak"


	ADD OBJECT cmdspeak AS commandbutton WITH ;
		Top = 192, ;
		Left = 264, ;
		Height = 23, ;
		Width = 72, ;
		FontSize = 8, ;
		Caption = "Speak", ;
		TabIndex = 11, ;
		ZOrderSet = 16, ;
		Name = "cmdSpeak"


	ADD OBJECT _commandbutton1 AS _commandbutton WITH ;
		Top = 228, ;
		Left = 264, ;
		Height = 24, ;
		Width = 72, ;
		Caption = "US", ;
		Name = "_commandbutton1"

    PROCEDURE Init
      Thisform.cmdmerlin.Click
    Endproc  


    PROCEDURE setcap
      IF RIGHT(thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID,2) == "E}"
        Thisform._commandbutton1.Caption = "British"
      ELSE
        Thisform._commandbutton1.Caption = "US"
      ENDIF
    Endproc

	PROCEDURE lbxanimations.Requery
		this.clear()
		For Each lcAnimation In thisform._agent.activeAgent.animationNames
			this.addItem(lcAnimation)
		EndFor
	ENDPROC


	PROCEDURE cmdplay.Click
		thisform._agent.play(Alltrim(thisform.lbxAnimations.DisplayValue))
	ENDPROC


	PROCEDURE cmdstop.Click
		thisform._agent.stop()
	ENDPROC


	PROCEDURE cmdpeedy.Click
	    If thisform._agent.load("Peedy","peedy.acs")
    	  thisform.cAgent = "Peedy"
		  thisform._agent.setActiveAgent("Peedy")
		  Thisform.setCap()
		  thisform._agent.show(Rand() * 400, Rand() * 400)
		  thisform.lbxAnimations.Requery()
		Else
		  =MessageBox( PEEDY_NOT_INSTALLED_LOC, MB_ICONSTOP)
		Endif
	ENDPROC


	PROCEDURE cmdrobby.Click
		If thisform._agent.load("Robby","Robby.acs")
		  thisform.cAgent = "Robby"
		  thisform._agent.setActiveAgent("Robby")
		  Thisform.setCap()
		  thisform._agent.show(Rand() * 400, Rand() * 400)
		  thisform.lbxAnimations.Requery()
		Else
		  =MessageBox(ROBBY_NOT_INSTALLED_LOC, MB_ICONSTOP)
		ENDIF
	ENDPROC


	PROCEDURE cmdgenie.Click
		If thisform._agent.load("Genie","genie.acs")
		  thisform.cAgent = "Genie"
		  thisform._agent.setActiveAgent("Genie")
		  Thisform.setCap()
		  thisform._agent.show(Rand() * 400, Rand() * 400)
		  thisform.lbxAnimations.Requery()
		Else
		  =MessageBox( GENIE_NOT_INSTALLED_LOC, MB_ICONSTOP)
		Endif
	ENDPROC


	PROCEDURE cmdmerlin.Click
		If thisform._agent.load("Merlin","merlin.acs")
		  thisform.cAgent = "Merlin"
		  thisform._agent.setActiveAgent("Merlin")
		  Thisform.setCap()
		  thisform._agent.show(Rand() * 400, Rand() * 400)
		  thisform.lbxAnimations.Requery()
		Else
		  =MessageBox( MERLIN_NOT_INSTALLED_LOC, MB_ICONSTOP)
		Endif
	ENDPROC


	PROCEDURE cmdshowtime.Click
		With thisform._agent

			If .load("Peedy", "Peedy.acs") And .load("Merlin", "Merlin.acs")
				If .load("Genie", "Genie.acs")
		        	If .setActiveAgent("Genie")
		        		.hide()
		        	Endif
		        Endif
		  
				If .load("Robby", "Robby.acs")
		        	If .setActiveAgent("Robby")
		        		.hide()
		        	Endif
		        EndIf

		    	If .setActiveAgent("Peedy")
		    		.hide()
		    	Endif

		    	If .setActiveAgent("Merlin")
		    		.hide()
		    	Endif

		    	.setActiveAgent("Peedy")
		    	.show(400,200)

		    	.setActiveAgent("Merlin")
		    	.show(200,200)
		    	.play("Announce")
		    	.play("GestureLeft")
		    	loMReq = .Speak(ST_M_01_LOC)
		    
		    	.setActiveAgent("Peedy")
		    	.wait(loMReq)
		    	.play("lookright")
		    	loPReq = .Speak(ST_P_01_LOC)
		    	.play("lookrightreturn")
		    
		    	.setActiveAgent("Merlin")
		    	.wait(loPReq)
		    	.play("Explain")
		    	loMReq = .Speak(ST_M_02_LOC)
		    	.play("LookLeft")
		    
		    	.setActiveAgent("Peedy")
		    	.wait(loMReq)
		    	.play("think")
		    	loPReq = .Speak(ST_P_02_LOC)
		    	.play("restpose")
		    
		    	.setActiveAgent("Merlin")
		    	.wait(loPReq)
		    	.play("lookleftreturn")
		    	.play("Pleased")
		    	.Speak(ST_M_03_LOC)
		    	loMReq = .play("surprised")
		    
		    	.setActiveAgent("Peedy")
		    	.wait(loMReq)
		    	.Speak(ST_P_03_LOC)
		    	.moveTo(250,200)
		    	loPReq = .play("domagic1")
		    	.play("domagic2")
		    
		    	.setActiveAgent("Merlin")
		    	.wait(loPReq)
		    	.hide()
		    
		    	.setActiveAgent("Peedy")
		    	.play("Pleased")
		    	.hide()
		    Else
		    	=MessageBox(SHOWTIME_REQUIREMENTS_LOC, MB_ICONSTOP)
			Endif
		EndWith
	ENDPROC


	PROCEDURE cmdspeak.Click
		thisform._agent.speak(this.parent.txtSpeak.value)
	ENDPROC


	PROCEDURE _commandbutton1.Click
		IF This.Caption = "US"
		  This.Caption = "British"
		  IF thisform.cAgent = "Peedy"
            thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID = "{227A0E40-A92A-11d1-B17B-0020AFED142E}"
		  ELSE
            thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID = "{227A0E41-A92A-11d1-B17B-0020AFED142E}"
          Endif
		ELSE
		  This.Caption = "US"
		  DO case
		    CASE thisform.cAgent = "Merlin"
              thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID = "{CA141FD0-AC7F-11D1-97A3-006008273002}"
            CASE thisform.cAgent = "Peedy"
              thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID = "{CA141FD0-AC7F-11D1-97A3-006008273001}"
            CASE thisform.cAgent = "Robby"
              thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID = "{CA141FD0-AC7F-11D1-97A3-006008273006}"
            CASE thisform.cAgent = "Genie"
              thisform._agent.agentcontrol.Characters(thisform.cAgent).TTSModeID = "{CA141FD0-AC7F-11D1-97A3-006008273000}"
            Endcase
		Endif 
	ENDPROC


ENDDEFINE
*
*-- EndDefine: frmsolution1
**************************************************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform