473,698 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SendKeys.Send only runs first time

Hello,

i built a small system-tray application that listens to a hotkey builds
a string and inserts the string to the active application using
SendKeys.Send()

The Problem is - this works only once. The hotkey is still o.k. (i also
copy the string to the clipboard, here I always get the correct string
that contains a timestamp) but sendkeys sends strange characters the
second time:

{}[}}[²
or
{}[}}[}

Depending on the active application sometimes the second time no string
at all is sent.

Can you please help me with this?

Thanks Alfred

Nov 17 '05 #1
5 2397
I havent used sendkey for years, and i have always had problems, if you want
to put some text in somewhere you may be able to use the clipboard and send
the Windows Message the triggers a Paste.

Steve
<al************ ***@gmx.de> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hello,

i built a small system-tray application that listens to a hotkey builds
a string and inserts the string to the active application using
SendKeys.Send()

The Problem is - this works only once. The hotkey is still o.k. (i also
copy the string to the clipboard, here I always get the correct string
that contains a timestamp) but sendkeys sends strange characters the
second time:

{}[}}[²
or
{}[}}[}

Depending on the active application sometimes the second time no string
at all is sent.

Can you please help me with this?

Thanks Alfred
Nov 17 '05 #2
Try using SendWait() instead of Send() in order to make sure the first group
of keys was processed by the receiver before sending another group.

Brendan
"al************ ***@gmx.de" wrote:
Hello,

i built a small system-tray application that listens to a hotkey builds
a string and inserts the string to the active application using
SendKeys.Send()

The Problem is - this works only once. The hotkey is still o.k. (i also
copy the string to the clipboard, here I always get the correct string
that contains a timestamp) but sendkeys sends strange characters the
second time:

{}[}}[²
or
{}[}}[}

Depending on the active application sometimes the second time no string
at all is sent.

Can you please help me with this?

Thanks Alfred

Nov 17 '05 #3
Thanks for your answer,

the problem is, the users don't wan't to loose there current clipboard.
That's why I thought about sendkeys

Bye Alfred

Nov 17 '05 #4
Hi Brendan,

thanks for your answer, but this didn't help

Bye Alfred

Nov 17 '05 #5
You can save and resotre the clip board.

Steve
<al************ ***@gmx.de> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Thanks for your answer,

the problem is, the users don't wan't to loose there current clipboard.
That's why I thought about sendkeys

Bye Alfred

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5695
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are in a table with headings for each column, so converting an Access report to a Word doc in RTF doesn't work because only the text is converted, not the table. What I have tried so far, with some success, is to write the report directly in Word....
2
3077
by: ABinBoston | last post by:
I have a macro that uses the SendKeys function to send F9 - to auto save a record. The Application runs perfectly on many PCs, but on one I get the following error. SendKeys Action Requires the "Application Name" Add-in to be loaded when OK is clicked, a message appears saying "Action Failed" Does anyone know what Add-in is being referred to?
2
6263
by: Gary | last post by:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)"); This is not working ..what could be the reason..? Situation: I have a menu in my form, which is given a short key "Ctrl+P", now when the
1
27250
by: GrantS | last post by:
I need to use a sendkeys key combination to automate the "accept files" that a remote user wants to send to me via Windows messenger. I am using automation to work with Windows Messenger client in a Winforms C# application. I have tried a number of code segment combinations for ALT T combination without success. The combinations might be correct but it might be failing for some other reason. My Attempts:
2
3509
by: MLH | last post by:
I have the following code with a SendKeys statement in it. 100 If Me.Dirty Then MsgBox "Form is Dirty!" 120 Dim MyQ As String, MyTitle As String, Response As Boolean 140 MyQ = "You started to enter something. Are you sure you want to quit without saving?" 180 MyTitle = "Continue? - " & MyApp$ & ", rev. " & MY_VERSION$ 240 Response = AskUserQ(MyQ, MyTitle, vbQuestion, vbDefaultButton1)
0
2748
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) To map "Keys" objects to their string constant, and stored them on a string Queue as they were happening. Then (after resetting the form), I simulate replaying of these actions by flushing the queued...
7
8636
by: =?Utf-8?B?Vmlua2k=?= | last post by:
public void sendKeysTest() { Process myProcess = Process.Start(@"C:\winnt\system32\cmd.exe"); SetForegroundWindow(myProcess.Handle); if (myProcess.Responding) SendKeys.SendWait("{ENTER}"); else
1
3228
by: Boki | last post by:
Hi All, I am trying to create a auto login program. Below is the part of code, my issue is - the target form ( handle / window ) usually didn't perform the key I sent from my C# program correctly. I think it should be timing issue, I add a delay there, but it seems incorrect.
4
3792
by: Silgd1 | last post by:
Hi All.... I am using python 2.4. I have a python script on an xp machine. This machine is on a network, and is dedicated to running python scripts. I use remote desktop to access the machine thru the network. I have a script on this machine which uses Cpamie and SendKeys to navigate a website. I use "from SendKeys import *" Here is the problem. I have the script automated to run, using windows' "scheduled task". When I log into the...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9027
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.