Page 1 of 1

The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 6:41 pm
by richmond62
So . . . perhaps the simplest thing is to import text from the PDF version of
the Script Guide into 'something' and search it;

Code: Select all

on mouseUp
   ask "Search Term"
   put it into SSS
   put 1 into LYNE
   put 1 into NLYNE
   repeat until line LYNE of fld "ff" is empty
      if line LYNE of fld "ff" contains SSS then
         put line LYNE of fld "ff" into line NLYNE of fld "fSREZ"
         add 1 to NLYNE
      end if
      add 1 to LYNE
   end repeat
end mouseUp
Horribabbabbly SLOW.

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 7:04 pm
by FourthWorld
The User Guide?

How did you import a PDF into a field?

The markdown text should be available at GitHub.

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 7:24 pm
by richmond62
FourthWorld wrote:
Tue Jun 16, 2020 7:04 pm
The User Guide?

How did you import a PDF into a field?
In a "very sophisticated fashion": I opened the PDF in a PDF reader and copy-pasted it into a LiveCode field.

Sorry to disappoint you. 8)
The markdown text should be available at GitHub.
A direct link would be extremely useful.

Mind you, that may not be necessary:
-
Screenshot 2020-06-16 at 21.27.08.png

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 7:30 pm
by richmond62
The only snag might be that those documents are documentS rather than
one monolithic thing.

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 7:35 pm
by richmond62

Code: Select all

on mouseUp
   put empty into fld "fSREZ"
   ask "Search Term"
   put it into SSS
   put 1 into LYNE
   put 1 into NLYNE
   put fld "ff" into STORED
   repeat until line LYNE of STORED is empty
      if line LYNE of STORED contains SSS then
         put line LYNE of STORED into line NLYNE of fld "fSREZ"
         add 1 to NLYNE
      end if
      add 1 to LYNE
   end repeat
end mouseUp
Cripes: almost as thrilling as watching paint dry.

The short-attention-span brigade will have forgotten why they searched for something before the results arrive. :twisted:

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 7:38 pm
by richmond62
So, I'm going to try this:

Code: Select all

on mouseUp
   put empty into fld "fSREZ"
   ask "Search Term"
   put it into SSS
   put 1 into LYNE
   put 1 into NLYNE
   put the STORD of btn "SD" into STORED
   repeat until line LYNE of STORED is empty
      if line LYNE of STORED contains SSS then
         put line LYNE of STORED into line NLYNE of HEREWEGO
         add 1 to NLYNE
      end if
      add 1 to LYNE
   end repeat
   put HEREWEGO into fld "fSREZ"
end mouseUp
Where the STORD (custom property) of button "SD" contains the text of the script guide.

Youch! The only apparent difference is that one has to wait until the whole routine
has finished to see anything in the output field.

Can one "just" search a custom property without having to put that into a variable first?

And would that speed things up? Doubtful.
-
LW.jpeg

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 7:53 pm
by richmond62
Quoting myself :?
Can one "just" search a custom property without having to put that into a variable first?
Yes, that can be done, but only marginally faster.

Code: Select all

on mouseUp
   put empty into fld "fSREZ"
   ask "Search Term"
   put it into SSS
   put 1 into LYNE
   put 1 into NLYNE
   repeat until line LYNE the STORD of btn "SD" is empty
      if line LYNE of the STORD of btn "SD" contains SSS then
         put line LYNE of the STORD of btn "SD" into line NLYNE of fld "fSREZ"
         add 1 to NLYNE
      end if
      add 1 to LYNE
   end repeat
end mouseUp
-
wman.jpg

Re: The LiveCode Script Guide cannot be searched

Posted: Tue Jun 16, 2020 8:14 pm
by richmond62
What is interesting is that if one concatenates all the Markdown files in the folder "guides" into
a single text field in a stack and then searches (Ctrl/CMD F) for 'backdrop' it only lists a single instance
inwith that field when there are many.
-
Screenshot 2020-06-16 at 22.12.00.png

Re: The LiveCode Script Guide cannot be searched

Posted: Wed Jun 17, 2020 5:23 pm
by jacque
One of the biggest reasons for the slowness is that you are counting lines rather than using "repeat for each".

Re: The LiveCode Script Guide cannot be searched

Posted: Wed Jun 17, 2020 6:45 pm
by richmond62
jacque wrote:
Wed Jun 17, 2020 5:23 pm
One of the biggest reasons for the slowness is that you are counting lines rather than using "repeat for each".
After "only" 20 years with LiveCode I still believe I'm a beginner. 8)

Thank you for pointing that out.