neopolis
asked on
What is the Ms Agent command for Clipboard
Hello
anyone know what the Ms Agent command is for reading from the windows clipboard
sample code required thanks
anyone know what the Ms Agent command is for reading from the windows clipboard
sample code required thanks
ASKER
Hello Rick
I am using Microsoft ActiveX control
Below is my code
-------------------------- -------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleCtrls, AgentObjects_TLB;
type
TForm1 = class(TForm)
Agent1: TAgent;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
MyAgent: IAgentCtlCharacterEx;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender : TObject);
begin
Agent1.Characters.Load('my agent', 'c:\WINDOWS\MSagent\Chars\ genie.acs' );
MyAgent := Agent1.Characters.Characte r('myagent ');
MyAgent.Show(0);
//THIS IS WHERE THE AGENT SPEAKS
//instead of him speaking the words 'look i can speak'
//i want him to speak from the windows clipboard
MyAgent.Speak('Look! I can speak!','');
end;
end.
//Rick because i am new in delphi
you may have to fill in the above code for me
Uses etc
thanks Neopolis
I am using Microsoft ActiveX control
Below is my code
--------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, OleCtrls, AgentObjects_TLB;
type
TForm1 = class(TForm)
Agent1: TAgent;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
MyAgent: IAgentCtlCharacterEx;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender
begin
Agent1.Characters.Load('my
MyAgent := Agent1.Characters.Characte
MyAgent.Show(0);
//THIS IS WHERE THE AGENT SPEAKS
//instead of him speaking the words 'look i can speak'
//i want him to speak from the windows clipboard
MyAgent.Speak('Look! I can speak!','');
end;
end.
//Rick because i am new in delphi
you may have to fill in the above code for me
Uses etc
thanks Neopolis
Let's start with the following.
Change:
Old:Agent1.Characters.Load ('myagent' , 'c:\WINDOWS\MSagent\Chars\ genie.acs' );
New:Agent1.Characters.Load ('myagent' , 'genie.acs');
It should run this way. If you find you have a path problem then copy the acs to the project directory. You can't count on the control being in any particular place. (Mine errored right away because my OS is on F: Drive)
Change:
Old:MyAgent.Show(0);
New:MyAgent.Show(False);// Show Fast(True/False)
What you have works but True/False will be easier to remember.
In the Destroy Event for the form add the following:
procedure TForm1.FormDestroy(Sender: TObject);
begin
if MyAgent <> nil then
begin
MyAgent.Hide(False); //Hide The Agent
MyAgent.StopAll(''); //Stop Any Pending Actions
Agent1.Characters.Unload(' myagent'); //Unload the Character
end;
end;
This should ensure the agent gets unloaded. This can also be used to unload in your app.
I will see what I can come up with for the clipboard.
Rick Halle
BTW: Your code for opening the agent is essentially the same as what I am using currently and I did not need to add or change the units clause.
Change:
Old:Agent1.Characters.Load
New:Agent1.Characters.Load
It should run this way. If you find you have a path problem then copy the acs to the project directory. You can't count on the control being in any particular place. (Mine errored right away because my OS is on F: Drive)
Change:
Old:MyAgent.Show(0);
New:MyAgent.Show(False);//
What you have works but True/False will be easier to remember.
In the Destroy Event for the form add the following:
procedure TForm1.FormDestroy(Sender:
begin
if MyAgent <> nil then
begin
MyAgent.Hide(False); //Hide The Agent
MyAgent.StopAll(''); //Stop Any Pending Actions
Agent1.Characters.Unload('
end;
end;
This should ensure the agent gets unloaded. This can also be used to unload in your app.
I will see what I can come up with for the clipboard.
Rick Halle
BTW: Your code for opening the agent is essentially the same as what I am using currently and I did not need to add or change the units clause.
ASKER
I will try this now *smiles*
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Am trying this now, yes i like the way the form destroy scloses everything fast back soon.
ASKER
unreal Rick i would have been here forever trying to work that out, it works very nicely...Thank you very very much
my email add is neopolisoz@yahoo.com.au if you want you can write me there i would like to send you some Post cards from Australiaas a further appreciation *smiles*
thanks again
my email add is neopolisoz@yahoo.com.au if you want you can write me there i would like to send you some Post cards from Australiaas a further appreciation *smiles*
thanks again
Rick Halle