var MyFileSystem = new ActiveXObject("Scripting.FileSystemObject"); var MyTextFile = MyFileSystem.OpenTextFile("Comments.txt", 1); if(MyFileSystem.FileExists("Comments.txt")) { //odczyt całej zawartości pliku do zmiennej var All_Content = MyTextFile.ReadAll(); MyTextFile.Close(); //ostatnie wystąpienie słowa "%Comment%:" var Last_Comment_Position = All_Content.lastIndexOf("%Comment%:"); //wycięcie ostatniego komentarza i przekazanie do zmiennej var Last_Comment = All_Content.slice(Last_Comment_Position+11); //przekazanie ostatniego komentarza do ProcessPoint'a var CommentPointName = ThisConfiguration.GetDynamicObjectByName("CommentPoint"); CommentPointName.WriteValueToPrimaryDataSource(Last_Comment); } else { MessageBox.Show("File does not exist!"); }