Results 1 to 4 of 4

Thread: how use sendkeys

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    97

    how use sendkeys

    hi,
    i want copy a selected text from notepad to my aplication using the sendkeys and clipboard of windows i using this code:


    SendKeys "{end}", True
    SendKeys "+{home}", True
    Clipboard.Clear
    SendKeys "{DOWN}", True

    so far so good this can select the text that i want now i want send this selected text to the clipboard i using this:

    'SendKeys "^{c}", True
    but this don´t work and i can´t understand why


    so my question is how can i press "CTR + C" by using the sendkeys to copy a selected text? or there is other way using a api to do this?
    thanks a lot for your help

  2. #2
    Hyperactive Member Quiver318's Avatar
    Join Date
    Sep 2007
    Posts
    260

    Re: how use sendkeys

    Sometimes fighting the menus is a pain. Why not try this, instead? Same effect, but it is now Windows doing the work instead of Notepad.

    Code:
      SendKeys "^{INSERT}"

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: how use sendkeys

    Try

    SendKeys "^(C)", True

    use () instead of {}
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: how use sendkeys

    It's OK with : SendKeys "^(C)", True
    But it's also OK with : SendKeys "^C", True

    Parentheses are only required for multiple characters sent with Ctrl (or Shift or Alt) key:
    SendKeys "^(CD)", True
    is different with
    SendKeys "^CD", True

    Curly brackets { } are required and only be used with special keys on keyboard, such as {HOME}, {END}, {DOWN}, {TAB}, {F2}, ...
    (See Help on SendKeys Statement for full listing.)

    Example:
    SendKeys "^(END)", True: hold down Control key while pressing "E" then "N" then "D".
    SendKeys "^{END}", True: hold down Control key while pressing End-key.
    SendKeys "^END", True: hold down Control-key while pressing "E", then release Control-key, then press "N" then "D".
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

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