none
Powershell script that reads currently open notepad txt file RRS feed

  • General discussion

  • Hello, I would like to have a powershell script that I can use to show me a subset of lines in a currently open txt file. The way I'm trying to get it to work is I open the text file (from anywhere i.e email attachments etc..) and also the script in ISE. The script asks what I would like to search for and then either waits a few seconds while I bring the notepad window to the front or it activates it on its own. I'm getting stuck on the path part. I dont want to (or cant?) supply a path. I want it to read the text in the current notepad window and then show me just the search hits in a new pop up window. Anyone know how I can do this? Thanks.....

    • Changed type Bill_Stewart Wednesday, September 13, 2017 8:46 PM
    • Moved by Bill_Stewart Wednesday, September 13, 2017 8:47 PM Unanswerable drive-by question
    • Edited by 123rdemaat Thursday, September 14, 2017 7:50 PM
    Tuesday, July 18, 2017 8:12 PM

All replies

  • Keep in mind that nobody can see your screen, so it's next to impossible to understand what you are asking. Try to focus on a single, specific question. Also, read this first:

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Tuesday, July 18, 2017 8:18 PM
  • Notepad is not an automation object.  The only way to find its document is to get its command line or window title.  Emails do not open in notepad they open in Outlook.  YOU can get the open inspector using Outlook automation.

    There is no general method to get a specific programs current document.  It is on a program-by-program basis and requires a fairly high level of programming skill.


    \_(ツ)_/

    Tuesday, July 18, 2017 8:35 PM
  • Does not do what you asked for in your original question.  It just reads a file that is open in notepad. If notepad changes the code will not see it.


    \_(ツ)_/

    Thursday, September 14, 2017 3:25 PM