Thread Tools Display Modes
01/14/16, 11:16 PM   #1
vandel212
Join Date: Jan 2016
Posts: 17
Illegal Call CopyAllTextToClipboard

First off let me appologize, it seems as though I have taken over the forum with all my posts. I truely do look for solutions before posting here (Google + Forum search tool + Wiki + API documentation), but being that this isn't the most common programming language, and it revolves around a MMO's API the available info is limited (espeically compared to straight up c# (my bread and butter)). I really appreciate all the help, you guys/gals are fantastic!

Ok, so I found this nifty little thread here with some code on how to copy text to the clipboard. When I run the code, it tells me an addon is trying to make an illegal call to [CopyAllTextToClipboard]. Being that there are addons here that do exactly that, there must be something I'm missing. Any help would be greatly appreciated.

Here is the code that uses it, so when I open up my inbox I get the error (starting at line 12). Right now I'm just trying to get it to copy "Hello World" to the clipboard:

Lua Code:
  1. function CopyMailStuff.ReadableMail(eventCode, mailId) 
  2.     AttachmentsString = ""
  3.     local mail = {}
  4.     mail.senderDisplayName, mail.senderCharacterName, mail.subject, mail.icon, mail.unread, mail.fromSystem, mail.fromCustomerService,
  5.     mail.returned, mail.numAttachments, mail.attachedMoney, mail.codAmount, mail.expiresInDays, mail.secsSinceReceived = GetMailItemInfo(mailId)
  6.  
  7.     if mail.numAttachments > 0 then
  8.         local intAttachmentCounter = 1     
  9.         local intNumberOfAttachments = mail.numAttachments
  10.         AttachmentsString = mailId .. "<,|,>" ..    mail.senderDisplayName .. "<,|,>" .. mail.subject ..
  11.        
  12.         clipBoardControl = WINDOW_MANAGER:CreateControl("Chat2ClipboardControl", GuiRoot, CT_EDITBOX)
  13.         clipBoardControl:SetHidden(true)
  14.         clipBoardControl:SetMaxInputChars(1000)
  15.        
  16.         clipBoardControl:SetText("Hello World")
  17.         clipBoardControl:CopyAllTextToClipboard()  
  18.        
  19.     end
  20. end

Last edited by vandel212 : 01/14/16 at 11:18 PM.
  Reply With Quote
01/15/16, 12:28 AM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
You can't do it. Your not missing anything, there are no addons that can do it. We used to be able to copy to the clipboard, but they removed our ability to do so. The closest we can do is create an editbox, dump text into it, highlight it, & then the user can manually click cntrl+c to copy it themselves.

Last edited by circonian : 01/15/16 at 12:31 AM.
  Reply With Quote
01/15/16, 12:29 AM   #3
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
The post is from 2014. This method was made private by ZOS. They don't want to automate (mass) copying of text via clipboard. Since than addons just offer a edit-box and the user has to press the strg-C.
You are not doing something wrong. It is just forbidden.
  Reply With Quote
01/15/16, 01:38 AM   #4
vandel212
Join Date: Jan 2016
Posts: 17
Originally Posted by votan View Post
The post is from 2014. This method was made private by ZOS. They don't want to automate (mass) copying of text via clipboard. Since than addons just offer a edit-box and the user has to press the strg-C.
You are not doing something wrong. It is just forbidden.
Darn. Thanks for the info.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Illegal Call CopyAllTextToClipboard


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off