Page 1 of 1

Script: Select a range of chars in revScriptEditor

Posted: Wed Apr 05, 2017 12:40 pm
by pderks
After an operation "Find Strings in Scripts" the field "FoundList" (autohilite & listbehavior) contains a list of founds, e.g.:
field id 1018 of card id 1002 of stack "/A/LiveCode 8.1.3 ƒ/Edit ƒ/pdA.livecode" (tab) 14,31

LineClick in this field sends "RetrieveInScript", which opens the script editor and selects and colors the given range of characters.

Code: Select all

on RetrieveInScript
   set the ItemDelimiter to tab
   get the HilitedText of fld "FoundList"
   put item 1 of it into ObjDesc
   put item 2 of it into CharRange
   set the ItemDelimiter to comma
   put item 1 of CharRange into CharFirst
   put item 2 of Range into CharLast
   edit the Script of ObjDesc -- 2 times
   edit the script of ObjDesc
   select last char of fld "Script" of window "revNewScriptEditor 1" -- else last visible line is selected & colored
   select char CharFirst to CharLast of fld "Script" of window "revNewScriptEditor 1"
   set the TextColor of char CharFirst to CharLast of fld "Script" of window "revNewScriptEditor 1" to „red“
end RetrieveInScript
I hope this contribution may be helpful …

Peter