Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <filesystem>
- #include <chrono>
- #include <thread>
- #include <windows.h>
- using namespace std;
- void PrintText(string log_copy) {
- string line;
- size_t found = line.find("@");
- ifstream myFile;
- myFile.open(log_copy);
- getline(myFile, line);
- if (found) {
- cout << line << endl;
- }
- myFile.close();
- }
- void RefreshText(const filesystem::path& filename) {
- HWND hwnd;
- hwnd = FindWindow(NULL, "Path of Exile");
- string s;
- string log_copy = "C:\\Users\\Toffer\\Desktop\\testfile.txt";
- auto file_time = filesystem::last_write_time(filename);
- while (true) {
- if (hwnd != 0) {
- if (filesystem::last_write_time(filename) != file_time) {
- file_time = filesystem::last_write_time(filename);
- filesystem::copy_file(filename, log_copy, filesystem::copy_options::overwrite_existing);
- PrintText(log_copy);
- this_thread::sleep_for(chrono::milliseconds(100));
- RefreshText("C:\\Users\\Toffer\\Desktop\\extreme.txt");
- break;
- }
- }
- if (hwnd == 0) {
- cout << "PoE is not running, launch it and restart this program." << endl;
- cout << "If you wish to close this program, press ENTER.";
- string s;
- getline(cin, s);
- break;
- }
- }
- }
- int main() {
- RefreshText("C:\\Users\\Toffer\\Desktop\\extreme.txt");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement