Copy charracter name with realm name

this right click function is an addon or default ui?i wanta copy name and realm with it,ios it possible?

This magical button appears where exactly?

If it’s on the character select screen then you’ve likely logged onto a PTR version of the game that enables you to copy characters from the live version of the game to use for testing on the PTR.

If you’re actually in-game then it’s likey an addon giving you the option to copy settings from one charater to setup another (or the currently logged on one).

Either way, you won’t be able to copy the name AND realm as the PTR uses different realm names (if you copy a name that already exists you’ll get a new name) and the live game only allows single unique name-realm combinations.

he is referring to this, but wants it to copy the realm name as well

Ah, thats not going to happen without Blizz. intervention because addons can’t programaticaly copy text to the clipboard. It requires an EditBox for the user to CTRL-C some text.

That said you could try something (a little less convenient) like:

local Backdrop = {
    bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
}

local f = CreateFrame("Button", "BakoraGetChatName", UIParent, "BackdropTemplate")
f:SetSize(200, 28)
f:SetPoint("BOTTOMLEFT", ChatFrame1, "TOPLEFT", 0, 50)
f:SetBackdrop(Backdrop)
f:SetClampedToScreen(true)
f:EnableMouse(true)
f:SetMovable(true)
f:SetUserPlaced(true)
f:RegisterForDrag("LeftButton")
f:RegisterForClicks("AnyUp")
f:SetScript("OnDragStart",function(self) 
    self:StartMoving()
end)
f:SetScript("OnDragStop",function(self)  
    self:StopMovingOrSizing()
end)

f.Text = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
f.Text:SetPoint("TOPLEFT", 5, -11)
f.Text:SetPoint("BOTTOMRIGHT", -1, 5)
f.Text:SetFontObject(GameFontNormalSmall)
f.Text:SetAutoFocus(false)
f.Text:SetScript("OnEscapePressed", function(self)
	self:ClearFocus()
	self:GetParent():Hide()
end)
f.Close = CreateFrame("Button", nil, f, "UIPanelCloseButton")
f.Close:SetSize(10, 10)
f.Close:SetPoint("TOPRIGHT")
f:Hide()

local copyString = "%s-%s"

hooksecurefunc(UnitPopupCopyCharacterNameButtonMixin, "OnClick", function(self, button, down)
	local dropdownMenu = UnitPopupSharedUtil.GetCurrentDropdownMenu()
	local name = format(copyString, dropdownMenu.name, dropdownMenu.server or GetRealmName())
	local nameLen = strlen(name)
	BakoraGetChatName.Text:SetText(name)
	BakoraGetChatName:Show()
	BakoraGetChatName.Text:SetFocus()
	BakoraGetChatName.Text:SetCursorPosition(nameLen)
	BakoraGetChatName.Text:HighlightText(0, nameLen)
end)

Which opens an EditBox with the name-realm selected to CTRL-C.
Use Escape or the X button to close.
Largely untested so caveat emptor…

You will have the name only on the ClipBoard courtesy of Blizz. until you CTRL-C.

Copy/Paste the code to the website addon.bool.no to

1 Like

Works With chat,Donno Why but player frames has nothing to ctrl-c

All good tho,thnx

Seperate menus used for different things (getting the name from a unit frame is not the same as getting it from a hyperlink in chat). Each one would need it’s own hook.

My UI doesn’t use bits of the default UI so I have no idea where these all are.

Fair Enough

edit : thank you anyway,exactly what i wanted

Turns out I lied, I just didn’t identify the right keys to get the information from. Updated the original code post. Not properly tested (getting server name for people on the same realm as you) because the servers were down for maintenance.

thnx dude

its working

1 Like