Missing chunk scripting issue

Ben Rubinstein benr_mc at cogapp.com
Sat Dec 18 19:32:46 EST 2004

on 19/12/04 12:09 am, Barry Levine wrote

> put char (theLast - 3) to char (theLast) of line 1 of field "result"
> Obviously I've got some kind of syntax problem with how I'm defining the
> range. Anyone care to suggest a solution?

The actual syntax error here is that you only specify the chunk (in this
case char) once, whether you're selecting a single chunk or a range.  So
instead of
  put char (theLast - 3) to char (theLast) of line 1 of field "result"

you want
  put char (theLast - 3) to (theLast) of line 1 of field "result"

But as Richard points out, in Transcript unlike HyperTalk you can in any
case count from the end of a range using negative numbers, hence

 put char -4 to -1 of line 1 of field "result"

would also get you what you want, with no need to first ask the length.
  Ben Rubinstein               |  Email: benr_mc at cogapp.com
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866

More information about the use-livecode mailing list