How to run a program and copy text to the clipboard

Page 1 of 2 12 LastLast

  1. Posts : 5
    Windows 10 Pro
       #1

    How to run a program and copy text to the clipboard


    Hi everyone,
    I'm running a program that requires me to enter a Serial number every time a start it. So can i start it and automatically copy my SN to the clipboard so I can paste it right away, and I used to run the program from task bar shortcut.

    any way I use this .bat file:
    @echo off
    start "Program" "C:\Program Files\program\program.exe"
    start "SN" "C:\Program Files\program\xxxxxx.txt"

    so it opens the text file right away, but I want to copy it right away without having to switch to the text file and close it
      My Computer


  2. Posts : 43,019
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Whether you can launch the program with a serial number as a parameter depends on the specification of the program - what the author decided to support.

    It may or may not - you'd need to research that. Trial and error will probably be just a waste of time.

    You would probably be better off using Autohotkey, with a small script to
    a. Launch the program
    b. Use the 'Send' command to send the string to the program.

    You will need to download and install Autohotkey (free). It has a very very extensive help file, and a supportive forum.
    It's a scripting language that is designed with particular features:
    - to support defining hot keys (hence the name)
    - to manipulate windows - existing GUI
    - a full range of 'normal' programming syntax allowing the building of complete small programs.
      My Computers


  3. Posts : 625
    Windows 10 Pro x64
       #3

    What program are you tryin to get this to work with? Without that information, we may be unable to work it for you. Also, if it's illegal software, you won't get support.
      My Computers


  4. Posts : 1,680
    X
       #4

    Try AutoHotkey. It lets you program various keyboard combinations to type any text you want.
    I have it set up to type my bank password whenever I type <ctrl><alt>b.
    And lots more.

    So, instead, you could configure it to type that serial number every time you key in <ctrl><alt>p (where p is for password).
    Or <ctrl><win><shift>p.
    Or any other combination that suits you.

    AutoHotkey is free. Check it out.
      My Computer


  5. Posts : 5
    Windows 10 Pro
    Thread Starter
       #5

    thanks to all of you guys...
    I already use Autohotkey , I have more than 30 shortcuts assigned to it and so much more functionality....
    Well, the program is a rendering program that can run offline only if you have your SN, it's like emergency you can say... but for me offline is a very normal situation and it happens all the time because my Internet connection is so bad.... LOL
    so it's legal!
    thanks again
      My Computer


  6. Posts : 43,019
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #6

    Hi, should have said
    Sendmessage - to send an expression/string to a program, not Send

    And if that didn't work, you wanted to define the content of the clipboard after launching the program you could use
    clipboard = my text ; Give the clipboard entirely new contents.

    Details of these in Help of course.
      My Computers


  7. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #7

    If you start it from a batch file you can do this.

    echo 123456789 | clip
    start program
      My Computers


  8. Posts : 152
    Windows 10 Pro/Education x64
       #8

    Have you had a look at Ditto clipboard manager from the windows store? It saves your clips so you don't have to keep putting the same clip everytime. Just run ditto automatically and your saved clips are available. I just click to open it and double click the saved clip to paste into notepad, for instance.
      My Computer


  9. Posts : 2,921
    Windows 10 Pro for the Bro
       #9

    I use a very useful program named Macro Express Pro (it's not free) and I always have it running.

    I have set up so many different automated processes (macros) through this program, that I find VERY useful. I understand that you prefer something free, yet if you have many different types of processes that require you to make repetitive processes, then I really recommend this program.

    This is a draft of a template of the process you would need it to do:
    1) Run program.exe
    2) Wait for program.exe to complete loading
    3) Open SN.txt
    4) Wait 100 milliseconds
    5) Focus window on SN.txt
    6) Wait 100 milliseconds
    7) Text Type: CTRL+A
    8) Wait 100 milliseconds
    9) Text Type: CTRL+C
    10) Wait 100 milliseconds
    11) Switch window to program.exe
    12) Wait 100 milliseconds
    13) Text Type: CTRL+V
    14) Mouse Move to the exact location of the Login box
    15) Mouse left click
    16) [Optional]: Close program SN.txt
      My Computer


  10. Posts : 5
    Windows 10 Pro
    Thread Starter
       #10

    Ztruker said:
    If you start it from a batch file you can do this.

    echo 123456789 | clip
    start program
    the program didn't start! but the text was copied to the clipboard
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:49.
Find Us




Windows 10 Forums