Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

send string to another windows application

Posted on 2006-11-23
13
Medium Priority
?
370 Views
Last Modified: 2010-04-05
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
Comment
Question by:hidrau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +1
13 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 18003662
yes you can, see this unit: http://megalib.com/books/51/sndkey32.htm
0
 
LVL 1

Author Comment

by:hidrau
ID: 18003708
have you already worked with this unit?

there is an error in this line:

line 259  While (Ido begin

0
 
LVL 19

Expert Comment

by:MerijnB
ID: 18003729
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:hidrau
ID: 18003762
ok, how does it work?
0
 
LVL 19

Accepted Solution

by:
MerijnB earned 1600 total points
ID: 18003793
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
 
LVL 1

Author Comment

by:hidrau
ID: 18003893
I have a notepad opened and I put your code in a button, but nothing was sent :((
0
 
LVL 1

Author Comment

by:hidrau
ID: 18003934
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
 
LVL 9

Assisted Solution

by:bernani
bernani earned 400 total points
ID: 18004030
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
 
LVL 28

Expert Comment

by:TName
ID: 18004034
>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
 
LVL 1

Author Comment

by:hidrau
ID: 18004089
ok,

it is working. :)))

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

Thanks
0
 
LVL 9

Expert Comment

by:bernani
ID: 18004141
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
 
LVL 9

Expert Comment

by:bernani
ID: 18004207
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
 
LVL 28

Expert Comment

by:TName
ID: 18004219
Hi bernani,
Look at hidrau's comment just above your first comment.
My answer was aimed at this.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question