How to copy and paste contents displayed on an application screen to a notepad? RRS feed

  • Question

  • Hello,

    I am trying to copy the data displaying on an application screen(Application like Termite.exe or other port sniffer)  and paste it into a notepad using Powershell Scripting. I am trying to use

    $wshell.SendKeys("^A") - for ctrl+a (Select all)
    $wshell.SendKeys("^C") - for ctrl+c (Copy)

    to copy the contents and open a new text file and to paste the copied data i use

    $wshell.SendKeys("^V") - for ctrl+v (paste)

    P.S. the application updates the screen every second.

    Kindly help me to automate this process.

    I also tried get-Contents and it also didnt work may be because i am trying to copy from the screen of a .exe application.

    • Edited by Rahul48313 Thursday, May 24, 2018 5:01 PM missing data
    Thursday, May 24, 2018 4:31 PM

All replies

  • Fist you have activate the app.

    This method is unreliable in NT as it was writing for Windows 9x and earlier and kept for compatibility.


    Thursday, May 24, 2018 4:42 PM
  • yes i did activate the app, i also used a mouse stroke to click on the display tab to make sure it copies the data from the display screen and not from any other.

    I am using windows powershell scripting btw.

    Thursday, May 24, 2018 5:02 PM
  • As I not. this will not work in NT most of the time.

    You must rub the code without clicking on anything.  Both appactivate and sendkeys must run undisturbed if it is going to work.


    • Proposed as answer by jrv Wednesday, May 30, 2018 3:50 PM
    Thursday, May 24, 2018 5:13 PM
  • I will try this and keep you posted
    Thursday, May 24, 2018 5:17 PM
  • is there any command to send mouse right click through powershell? because the appactive is not working.
    Wednesday, May 30, 2018 3:49 PM