That's very cool. I also use AutoHotkey. My "Tilt-Meter" reached its peak last week and wrote a different Script that accomplishes something similar. I hadn't thought of removing the last Character from the Clipboard. I thought this was a really interesting take. My version checks to see whether you're using Teams (similar to the "#IfWinActive, ahk_exe Teams.exe") and checks to see if the first character in the Clipboard is "[".
$^c::
{Send, ^cWinGet, PName, ProcessName, A
; Copy from Microsoft Teams 🡲 Remove HeaderIf (PName == "Teams.exe"){; Retrieve the First Character in the ClipboardStringLeft, FirstChar, Clipboard, 1
; If the First Character is [, Remove the HeaderIf (FirstChar == "["){
; Find the 2nd Carriage Return in the Clipboard and Store it's position in SecondRetCar
StringGetPos, SecondRetCar, Clipboard, `n, L2
; Retrieve the Full Length of Characters in the ClipboardTeamsMsgLen := StrLen(Clipboard)
; Delete the First Two Lines in the Clipboard, plus one character (-1), and store the Result in TeamsMsg
StringRight, TeamsMsg, Clipboard, TeamsMsgLen - SecondRetCar - 1
; Put the Result back into the ClipboardClipboard = %TeamsMsg%
Return}}}
Limitations with this Script are:
- When not copying the full content of a Teams message, if the first Character ends up being "[", the first two lines will be deleted, regardless. Example: If I Copy Text "Mid-Teams-Message", and the first Character Selected is "[". I consider this instance to be a rare occurrence, and I'm ok living with it for the time being.
- When Pasting the Contents of the Clipboard (with the Removed Header), you lose all Text Formatting (Bold, Italic, "Rich Text Parameters", etc.). I haven't found a way, as of yet, to keep Text Formatting in the Clipboard when altering its Contents. In my experience (so far at least), Text Formatting in Teams is not a common occurrence. I'm willing to fumble with the messages that do have Rich Text Formatting, for the few times I might encounter them.
- When Copying Multiple Messages, this Script also only Deletes the first Header. All other subsequent Headers are kept in the Clipboard. I'm not sure I want to spend time adding this Functionality to the Script. At this point, when Copy-Pasting a "Back-and-Forth" conversation, I think there is value in seeing, and knowing who said what... and come to think of it, I might just add a Functionality to keep the first Header when there are multiple Messages Copied... One Functionality to keep them all in, and another to remove them all perhaps? 🤔... In retrospect, my primary pain-point relates to one Teams Message (not multiple). Not being able to quickly select one full Message (which often times is only one full paragraph) and Pasting the information without the unnecessary doodoo that comes with it (the Date, Time and Author). The only useful information in this instance (when Copying only one message), is the Author, which is practically always conveyed before Copy-Pasting the information in the first place.