to append windows title to file

If you have a question or need help, this is the place to be.
Post Reply
Posts: 6
Joined: Sat Nov 30, 2019 7:04 am

to append windows title to file

Post by Tiddu » Sat Oct 31, 2020 10:52 am

i created a eg task that use nirsoft utilities nircmd cmd and take screenshot of all the windows I switch to using taskmonitor. i use this to recover pc session whenever pc crashed. this is working good but I am trying to append window titles and app name to the outcome.
C:\n.a.d\nircmd\nircmd.exe loop 1 1000 savescreenshot "C:\n.a.d\chkpix\addy all apps\scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.jpg"
I feel like this could use python , findwindow etc but I don't know python

current outcome - scr11_02_2020-10_42_20
desired outcome - excel_workbook1_scr11_02_2020-10_42_20

User avatar
Site Admin
Posts: 5508
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: to append windows title to file

Post by kgschlosser » Tue Nov 17, 2020 6:30 am

try the task monitor plus plugin. it is located here ... onitorPlus

This will tell you when an application has opened and also when it has closed. It will also generate an event if the Window Caption changes.

What you are interested in is the payload that is attached to the events.

create a new macro and add a python script action. paste the code below into the python script

Code: Select all

print eg.event.payload.title
drag and drop an event for an application opening into the macro. Then start the application and see what gets printed out.
If you like the work I have been doing then feel free to Image

Posts: 1
Joined: Thu Nov 26, 2020 9:28 am

Re: to append windows title to file

Post by bonnieshona » Thu Nov 26, 2020 11:15 am

Hello there
please try this steps to append windows title to file
1.// appending to window text file "myfile.txt"
2. #include <iostream>
3. #include <fstream>

4. int main () {
5. if (std::ofstream myfile ("myfile.txt", std::ios::app);
6. myfile.is_open()) {
7. myfile << "This is a line.\n";
8. myfile << "This is another line.\n";
9. // File automatically closed by ofstream destructor
10. }
11. else
12. std::cerr << "Unable to open file";

13. return 0;
14. }
Input/output with files

Post Reply