I wrote the below simple script several years ago to remove Visual Studio style info from clipboard text. Basically, it simply pastes the clipboard text to a new temporary document, copies the document text back to the clipboard, and close the temporary document.
I've wired the script to a RJTE toolbar command, so a simple press of my toolbar button cleans up the text currently in the clipboard. However, at some point in RJTE upgrades, the script began opening a "The current file has changed. Save changes?" dialog upon the call to "Document.Close()". According to my comments (again, from several years ago), that's the reason I called Document.Undo() just prior to Document.Close() - which apparently used to bypass the "Save?" dialog.
Interestingly, if I comment out the "Document.Close()" call, I can interactively close the temp document *without* seeing the "Save?" dialog.
I really just want to close the temp file without being asked to save it. What's the best way to do that using a current version (9.20) of RJTE?
Thanks,
Jeff
Code: Select all
#language C++Script
// Remove the VSS theme colorization from clipboard data and put the cleaned code
// back into the clipboard. This makes it possible to email code snippets without
// them containing the VSS theme colors.
{
// Create a new TXT document
MainApp.NewDocument(".txt");
// Paste the clipboard contents into the new doc
Document.PasteFromClipboard;
// Select the entire document
Document.SelectAll();
// Copy the selection to the clipboard
Document.CopyToClipboard();
// Undo the paste to prevent a "Save?" question on doc close
Document.Undo();
// Close the document (cleaned code is in the clipboard)
Document.Close();
// Add message to the status area.
MainApp.SetStatusText("Cleaned text is in the clipboard.");
}