LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
But that's not a very generic solution. And the "do" command is pretty slow.
If the text you want is already in the clipboard then the simplest solution is probably to select the chunk and say
As you can see the syntax is in both cases the same, Rev does not know that in the second case you dont want to put a value into the variable tChunk but into the value of the variable tChunk. I think this is the missing piece in your concept of variables. Once you operate at the level of putting something into a container (variable) and then at the level of putting something into the value of the container.
Mark Wieder's solution forces Rev to evaluate the whole expression (do) which does what you want but is slow as Mark pointed out.
Another way to do this would be
put the selectedChunk into tChunk
put word 2 of tChunk into tStart
put word 4 of tChunk into tEnd
put word -1 of tChunk into tSource -- field # or name
if tChunk <> "" then -- something has to be selected
put "hello" into char tStart to tEnd of field tSource
end if
Thanks for all your help guys. I actually did what Bernd suggested in my script before I asked the question, but I wondered if there was a more elegant or less verbose way of doing it.
I also tried "put xxx into the selection" and that didn't work for some reason (although that was last week and I may have got it wrong).