#===================================================================================
if theKey is "a" then  select  text of field "SubStack2Card1Field"   #Entire field is selected.   

if theKey is c then 
   if selectedText(field "SubStack2Card1Field")=empty then exit commandKeyDown 
   copy    
   
   #I had to use this "copy" command because livecode refused to copy a selection when a "regular" ctrl-c was made even though you can do it with the 
   #IDE menu bar EDIT/copy selection which SHOULD be the SAME thing. Other fields with EXACTLY the SAME field properties don't 
   #have this problem so we at loss why this particular field has this problem. 
   
   #Using "copy" with no arguments was the quickest and cleanest work around I came up with. This precludes having to use the clipboard function
   #which typically is used to determine the type of info in the clipboard, precludes using the clipboardData property (used to get or change the
   #data on the clipboard) and precludes using the selectedText function (used to determine what text is currently selected)
   
   #Put initial web page components in place including a web page title to ensure a standard web page
   put "<!DOCTYPE html>" & CR & "<html>" & CR & "<head>" & CR & "<title>=== USER SELECTED TEXT ===</title>" & CR & CR\
   & "</head>" & CR & CR & "<body>" & CR & CR into URL("file:" & defaultfolder & "/UserSelectedText.html")
   
   #The following is done to set up the necessary steps  to be able to select any field text (not just the entire field) 
   put selectedText(field "SubStack2Card1Field")  into xStringToFind
   
   put 0 into charsToSkip      
   put offset(xStringToFind, field "SubStack2Card1Field", charsToSkip) into StartCharNum                    
   put number(chars in  xStringToFind) into NumOfChars
   put StartCharNum+NumOfChars-1 into EndCharNum     
   
   #======================================================================================
   #Remedy the html coming out of LC by replacing the outdated  font tags with the correct "span" and inline CSS "style" tags.
   #This remedy will cause the html pageto show the text colored background where before only a black background is shown on the web page.
   #Once this is done,  the whole selection can be copied then pasted into almost any word processor that:
   # [a] Supports colored text backgrounds AND [b] Finds the incomimg copied text to be compatible with its paste styled format.
   
   #it is crucial that BOTH conditions be satisfied since what brought me to this "remedy discovery" was that I was able to succesfully paste
   #colored text backgrounds into word processor apps from many non livecode apps EVEN when I was being told that the problem was that the
   #word processors did not support colored text backgrounds. 
   
   #The significance of this is that it supplied the explanation of why copying colored text backgrounds directly from LC fields or LC's copy of the field
   # info into html files, would not work when paste was attempted into word processors that I had already proven did indeed support colored text
   #backgrounds.  
   
   #This means any direct copy from inside LC or any copy from its html without the recommended html fix, will cause the word procesors
   # to deem "the incomimg copied text INCOMPATIBLE with its paste styled format" since the word processors have already been proven to support
   #colored text backgrounds.
   
   #When the html remedy described below is supplied, the copied info then becomes compatible with the word processor's paste styled format
   #and the paste functionality will finally work across MOST true desktop and online word processors.
   #=========================================================================================
   
   put the htmlText of char StartCharNum to EndCharNum of field "SubStack2Card1Field"  after URL("file:" & defaultfolder & "/UserSelectedText.html")
   replace "<font bgcolor="  with  "<span style=" & quote & "background-color:" in URL("file:" & defaultfolder & "/UserSelectedText.html")
   replace "-color:" & quote & "#" with "-color:#" in URL("file:" & defaultfolder & "/UserSelectedText.html")
   replace "</font>"  with "</span>" in URL("file:" & defaultfolder & "/UserSelectedText.html")
   
   #This completes the formatting of the html file initially specified above.
   put CR & CR & "</body>" & CR & "</html>" after URL("file:" & defaultfolder & "/UserSelectedText.html")
   
   #As you can see Jacque, I had already tried your recommendation (last three lines) before many times. Unfortunately the clipboard contains the
   #source html which is not what we want pasted into the word processors. What we want pasted is the selection/copy from the re-made web page
   #display not its source contents. So let me know what is still missing to get this finally resolved or if I misunderstood your recommendation. 
   get URL("file:" & defaultfolder & "/UserSelectedText.html")
   set the clipboarddata["html"] to it   
   put clipboarddata["html"]  #I see only the html source code inside, so don't we still have to launch it to be able to re-select/copy its displayed info?
   
   #====================================================================================