Chat copy addon

Can anyone suggest an up-to-date addon for copying from the chat window? I don’t want any other chat features, only the ability to copy text.

You can’t copy directly from a chat frame to the clipboard, all you can do is copy the text to a game editbox widget and the copy from there using (select) Ctrl-C.

I don’t know of any addons that do only that and nothing else so if you don’t find anything better you can paste the code below into the website addon.bool.no to create/download a very basic addon to do this.

Using /copy it will paste the visible lines from ChatFrame 1 into a box you can copy from, clearing the box before adding the text.

Using /copy add will append the current visible lines to what is already in the copy frame.

Using /copy clear will clear the copy frame.

Using /copy show will display the copy frame with its current text.

Press Esc. (escape) to clear the cursor from the copy frame.

local upper = string.upper
local TheFrame
local Clear, NoReset, Show = 1, 2, 3
local function DisplayText(text, arg1)
	if not TheFrame then
			local backdrop = {
				bgFile = "Interface/BUTTONS/WHITE8X8",
				edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
				tile = true,
				edgeSize = 7,
				tileSize = 7,
				insets = {
					left = 2,
					right = 2,
					top = 2,
					bottom = 2,
				},
			}

		local f = CreateFrame("Frame", "FizzleCopyChat", UIParent, BackdropTemplateMixin and "BackdropTemplate")
		TheFrame = f
		f:SetBackdrop(backdrop)
		f:SetBackdropColor(0, 0, 0)
		f:SetPoint("LEFT", UIParent, 20, 0)
		f:SetSize(400, 300)
		f:SetMovable(true)  -- The rest is pretty much to make the frame dragable
		f:EnableMouse(true)
		f:RegisterForDrag("LeftButton")
		f:SetScript("OnDragStart", f.StartMoving)
		f:SetScript("OnDragStop", f.StopMovingOrSizing)
		f:SetClampedToScreen(true)
		f.Close = CreateFrame("Button", "$parentClose", f, "UIPanelCloseButton")
		f.Close:SetPoint("TOPRIGHT", -2, -2)
		f.Close:SetScript("OnClick", function(self)
			self:GetParent():Hide()
		end)
		f.Scroll = CreateFrame("ScrollFrame", "$parentScroll", f, "UIPanelScrollFrameTemplate")
		f.Scroll:SetPoint("TOPLEFT", f, 5, -30)
		f.Scroll:SetPoint("BOTTOMRIGHT", f, -30, 5)
		f.Text = CreateFrame("EditBox", "$parenEditbox", f)
		f.Text:SetMultiLine(true)
		f.Text:SetSize(f:GetSize())
		f.Text:SetPoint("TOPLEFT", f.Scroll)
		f.Text:SetPoint("BOTTOMRIGHT", f.Scroll)
		f.Text:SetMaxLetters(99999)
		f.Text:SetFontObject(GameFontNormal)
		f.Text:SetAutoFocus(false)
		f.Text:SetScript("OnEscapePressed", function(self) self:ClearFocus() end) 
		f.Scroll:SetScrollChild(f.Text)
	end
	if not TheFrame:IsShown() then
		TheFrame:Show()
	end
	if  arg1 == Show then return end
	if arg1 == NoReset then
		TheFrame.Text:SetText(TheFrame.Text:GetText().."-------------\n"..text)
	elseif arg1 == Clear then
		TheFrame.Text:SetText("")
	else
		TheFrame.Text:SetText(text)
	end
	TheFrame.Text:ClearFocus()
end

SLASH_FizzleCopyChat1 = "/Copy"
SlashCmdList["FizzleCopyChat"] = function(msg)
	local param
	if upper(msg) == "ADD" then
		param = NoReset
	end
	if upper(msg) == "CLEAR" then
		param = Clear
	end
	if upper(msg) == "SHOW" then
		param = Show
		DisplayText("", param)
	end
	local text = ""
	for i=#ChatFrame1.visibleLines, 1, -1 do
		if ChatFrame1.visibleLines[i].messageInfo then
			text = text..ChatFrame1.visibleLines[i].messageInfo.message.."\n"
		end
	end
	DisplayText(text, param)
end

ElvUI allows both per-line and full window chat copy to the Windows clipboard.