Batch file open, select all, copy
-
I’ve put some batch files together using python that collects specific information from the file in a specific directory then creates a text file based on that information. It then opens that text file (just changed the software it opens it with from notepad to notepad++) so I can view the info. The next step, which I currently do manually, is to hit “select all” and “copy” so I can then paste the info to a couple other locations. I would like to automate the “select all” and “copy” parts of this process via the command line (I know it doesn’t seem like much, but by automating every possible step in the process I have cut significant time off finishing the processes as well as taken away issues caused by human error). I am brand new to Notepad++ so I am hoping someone can assist me with this project. Thank you so much.
-
what do you mean by using python that collects specific information ?
You are using a local python installation or pythonscript plugin fro npp? -
I’d say forget the “via the command line” part.
Record a 2-step macro to do ctrl+a and then ctrl+c?
But I hardly think it worth it. You seemed to agree in your post.
-
Adam,
Install NppExec -> Open your Python script in Npp -> Execute ->
cd “$(CURRENT_DIRECTORY)”
C:\Python37\python.exe “$(FILE_NAME)”-> Select the output in the NppExec console -> Control C -> Done
You may need to change the path above to where your Python install is located. If you do a lot of this, you can save the script to reuse in NppExec and it will appear under the Macro menu.
Happy Pythoning 🐍
Steve
-
Oops, I meant to put:
INPUTBOX “$(FILE_NAME): Enter arguments or none to continue.”
cd “$(CURRENT_DIRECTORY)”
C:\Python37\python.exe “$(FILE_NAME)” $(INPUT)which gives you the option to give Python some command line arguments.
Steve