Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

send string to another windows application

Hello guys,

Is there any way to send a string to another application and in this application simulate enter?

Imagine that I have a string in a edit and I want to send this string to my notepad, each time I

press my buttom it send to my notepad the text and a enter code


This is possible?

alex
0
hidrau
Asked:
hidrau
  • 5
  • 3
  • 3
  • +1
2 Solutions
 
MerijnBSr. Software EngineerCommented:
yes you can, see this unit: http://megalib.com/books/51/sndkey32.htm
0
 
hidrauAuthor Commented:
have you already worked with this unit?

there is an error in this line:

line 259  While (Ido begin

0
 
MerijnBSr. Software EngineerCommented:
sorry, I thought it was the same as I'm using, apperantly not. Download mine here: http://www.xs4all.nl/~bosma/SendKeys.pas

please leave a message when you have it, so I can remove it again.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
hidrauAuthor Commented:
ok, how does it work?
0
 
MerijnBSr. Software EngineerCommented:
in the property titletext you enter the title of the window you want to send to.
the delay property is the delay between the keystrokes
the Keys property is what keys to send, there some special codes for that, look in the pas file, it's quite simple. Finally, call Execute()

 with TSendKey.Create(nil) do
 try
  TitleText := 'notepad';
  Delay := 2;
  Keys := 'this is a nice sentence[enter]';
  Execute();
 finally
  Free();
 end;
0
 
hidrauAuthor Commented:
I have a notepad opened and I put your code in a button, but nothing was sent :((
0
 
hidrauAuthor Commented:
ok, I understood. I need to pass the name of my windows-

if the name saved is 'test', so it must be 'test' and not notepad.

is there a way to pass only the name of program?

I want to send a text to a babylon dictionary, I don't know if you know it.

0
 
bernaniCommented:
Hi,

Maybe you can use the functions

function GetOtherWindowMemoText(const sCaption : String) : WideString;
function SetOtherWindowMemoText(const sCaption : String; const sText : String) : WideString;

carcotasu wrote for me  

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21481307.html



0
 
TNameCommented:
>I need to pass the name of my windows
No, the window title. Or at least a fragment of it.
e.g. 'Editor' for Notepad. Just have a look at the title bar...
0
 
hidrauAuthor Commented:
ok,

it is working. :)))

but I have another question, I will open a new thread.

Thanks
0
 
bernaniCommented:
Hi,

you answer:

>I need to pass the name of my windows
No, the window title. Or at least a fragment of it.

but your question is

Titel:  send string to another windows application
... to send a string to another application and in this application simulate enter?
Imagine that I have a string in a edit and I want to send this string to my notepad, each time I
press my buttom it send to my notepad the text and a enter code

Maybe I misunderstand but I don't see where your wrote in your question you wanted to pass the name of your windows ....


Sorry.
0
 
bernaniCommented:
Hi,

Thanks for the points.

Now I see where you're talking of .... passing the name of your windows .... Didn't have received this subject before psoting my answer.


 
0
 
TNameCommented:
Hi bernani,
Look at hidrau's comment just above your first comment.
My answer was aimed at this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now