The LiveCode Script Guide cannot be searched

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 6:41 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: The LiveCode Script Guide cannot be searched

Post by FourthWorld » Tue Jun 16, 2020 7:04 pm

The User Guide?

How did you import a PDF into a field?

The markdown text should be available at GitHub.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 7:24 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 7:30 pm

The only snag might be that those documents are documentS rather than
one monolithic thing.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 7:35 pm

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:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 7:38 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 7:53 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Tue Jun 16, 2020 8:14 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: The LiveCode Script Guide cannot be searched

Post by jacque » 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".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: The LiveCode Script Guide cannot be searched

Post by richmond62 » Wed Jun 17, 2020 6:45 pm

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.

Post Reply