Results 1 to 8 of 8

Thread: SendKeys help

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    SendKeys help

    im trying to write a simple automation system which does the following:

    get a string data (easy)
    click a textbox (easy)
    SendKey(string data) - problems

    now, the problem I am having is that when I am sending keys, say the text is:

    "hi how are you"

    sometimes it displays it just like that, most of the time it does this:


    hii hooowwwww arrrreeeee yooouuuu


    any ideas why?

    code:

    SendKeys.Send("hi how are you");

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: SendKeys help

    I dont know if i dont understand what you're asking, but doesnt SendKeys provide an automated way of sending keystrokes to an application?

    fOr e.g. SendKeys.Send("{ESC}");


    is the same as if the user pressed the escape key.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: SendKeys help

    yes I am aware of that.
    however I've resolved the issue now. Had to add a bit of a time delay

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  4. #4
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: SendKeys help

    Could you post your code, i'm always interested in learning new things. I still dont think i fully understand your question.

    Jennifer

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: SendKeys help

    code is pretty simple,

    for (int counter = 0; counter < 10; counter++)
    {

    Clipboard.SetText("hi how are you");
    SendKeys.SendWait("^(v)");
    Thread.Sleep(300);
    Clipboard.Clear();
    }


    how ever it still does the thing im complaining about.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: SendKeys help

    ok well now after some time (using the same code), it just pastes like several times sometimes and others just as it is meant to.
    all I want to do is paste once in a different position - I am of course setting the position to another textbox but when i execute the paste command key, as above, sometimes it just pastes the text several times.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  7. #7
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: SendKeys help

    Thanks, I think I understand what you're trying to do.

    Jennifer

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: SendKeys help

    i think its almost resolved now, had to really tell it how many keystrokes/times it should send those keystroke:

    Sendkeys.SendWait("^{v 1}");

    meaning press the CTRL and v key, once

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width