Copy to ClipBoard ?

Just starting out? Need help? Post your questions and find answers here.
vmars316
Posts: 8
Joined: Tue Oct 20, 2015 9:59 pm

Copy to ClipBoard ?

Post by vmars316 »

Hello & Thanks ,

Is it possible to 'Copy to ClipBoard ?' in SB ?

Thanks...Vern
Fred
Site Admin
Posts: 1820
Joined: Mon Feb 24, 2014 10:51 am

Re: Copy to ClipBoard ?

Post by Fred »

No, it's not natively supported for now, but I bet you can still use CTRL+C from your browser ? What did you have in mind for this command ?
the.weavster
Posts: 229
Joined: Sat Mar 01, 2014 3:02 pm

Re: Copy to ClipBoard ?

Post by the.weavster »

This works with Firefox and Chrome (hopefully others too):

Code: Select all

Procedure.i CopyToClipboard(txt.s)
  retval = 0
  !var x = document.createElement("TEXTAREA");
  !//styling is to prevent the element flashing on the screen
  !x.style.position = 'fixed';
  !x.style.top = 0;
  !x.style.left = 0;
  !x.style.width = '2em';
  !x.style.height = '2em';
  !x.style.padding = 0;
  !x.style.border = 'none';
  !x.style.outline = 'none';
  !x.style.boxShadow = 'none';
  !x.style.background = 'transparent';
  !x.value = v_txt;
  !document.body.appendChild(x);
  !x.select();
  !try {
    !var ok = document.execCommand('copy');
    !if(ok) { v_retval = 1; }
  !} catch(err) {
    !console.log(err.message);
  !}
  !document.body.removeChild(x);
  ProcedureReturn retval
EndProcedure
vmars316
Posts: 8
Joined: Tue Oct 20, 2015 9:59 pm

Re: Copy to ClipBoard ?

Post by vmars316 »

Fred wrote:No, it's not natively supported for now, but I bet you can still use CTRL+C from your browser ? What did you have in mind for this command ?
I wrote a clipboard program ( http://www.portablefreeware.com/index.php?q=cliplog&m= ) which I am thinking about making changes to , so that it ( clipLog ) examines what is being copied . And it looks thru its cliplog.ini file to see if there is an entry for that word .
If yes , cliplog would then launch the program associated with that word .

But I wanted to know if I could copy --> clipboard with SB .
I know that I could copy from any where , but I was thinking also of a local.webpage with all the keywords as Buttons .
Anyways , just an idea .
Thanks..vm
Post Reply