robm80 wrote:How difficult is LiveCode compared with Toolbook!
It's often simpler, since your earlier example:
Code: Select all
copy char 1 to -1 of field "pagename" of me to clipboard
...can execute in LC with just:
Code: Select all
copy char 1 to -1 of field "pagename" of me
It's the "to clipboard" part that was throwing it off. A quick visit to the Dictionary entry for the copy command shows no examples that include "to clipboard", which is sensible enough because the clipboard is the default destination for copied text and objects*.
The other syntax using the internal clipboardData array that Neil showed is for more extended functionality, offering a finer level of control than I recall having with Toolbook when I used it back in the day.
For example, the copy command will faithfully copy not only the text but also the style runs, but if you want to refine that to copy only the plain text stripped of all styles then the example provided by Neil will do the trick.
The other nice thing about Neil's array syntax example is that it hints at other array keys, which can be very useful in certain circumstances. Check out the Dictionary entry for clipboardData, and consider for example how you can set the clipboardData["htmlText"] to styled text constructed on the fly in a variable. or set the clipboardData["image"] to a snapshot of an object.
Lots of flexibility in LiveCode, and while my experience with ToolBook was limited to one project for a major retail chain I can remember only a handful of things it offered that I'd like to see added to LiveCode, while many LC things I'd love to see in TB.
* I wrote "default" because another nice extension to LiveCode is the ability to copy object from one container to another without modifying the user's clipboard, by specifying a destination object with "to", e.g.:
Code: Select all
copy group "MyCustomControl" of stack "MyTemplateObjects" to group "DrawingPane" of stack "MyCoolDrawingApp"
PS: I just added a bug report suggesting that your first example, "copy the text of <field specifier>", should also be supported:
http://quality.runrev.com/show_bug.cgi?id=12412