Page 1 of 1

Simpler Copy to clipboard command

Posted: Thu Mar 01, 2018 3:47 pm
by TorstenHolmer
Hi,

I want to make a recommendation:

I just wanted to put the text of a variable into the clipboard and wondered what is the reason, that:

copy tText into clipboard

does not work.

The "correct" way: set the clipboardData["text"] to tText is IMHO a harsh distraction from the english language style Livecode is proposing ;-)

Cheers,
Torsten

Re: Simpler Copy to clipboard command

Posted: Thu Mar 01, 2018 3:59 pm
by FourthWorld
If you're dealing with selected text (or even objects) the command is simply "copy". Couldn't get simpler.

But if you want to programmatically alter the clipboard without user intervention, that much less common use case requires less common syntax.

The reason for the array is that the range of ways in which a programmer might want to work with the clipboard can be quite vast, and clipboard structures provided by the OS are somewhat complex.

Indeed, even the most complicated LiveCode syntax for directly manipulating clipboard contents across platforms is far simpler than the OS APIs for any one of them.

An array variable is more complex than a simple string, but programming isn't natural language, and arrays are a very useful structure commonly available in nearly every programming language for their efficiency and utility.