B27:Search Project

Need help with a script? This is the place to discuss how to get your code running!

B27:Search Project

Postby sctell » Tue May 09, 2017 10:57 pm

Selected and copied title of a handler in the project script, copied it and pasted it into the Project Search utility and got this weird error.

have a look at the image below.

I am running OS X 10.12.4.

All the best

Terry


Screen Shot.png
Screen Shot.png (55.84 KiB) Viewed 567 times
sctell
 
Posts: 1130
Joined: Sun Jul 06, 2008 10:41 am

Re: B27:Search Project

Postby sctell » Tue May 09, 2017 11:02 pm

I realise that I had not selected a project to search but nevertheless it is still a weird error.

Upon selecting one of the scripts found and editing that script, the script did open but not at a line containing the searched for text.

Should it have highlighted all lines containing the searched for text or the first line or open at a random spot?

All the best

Terry
sctell
 
Posts: 1130
Joined: Sun Jul 06, 2008 10:41 am

Re: B27:Search Project

Postby Scott » Wed May 10, 2017 5:02 am

sctell wrote:I realise that I had not selected a project to search but nevertheless it is still a weird error.

Fixed.

Should it have highlighted all lines containing the searched for text or the first line or open at a random spot?

Actually, it just opens the script, so it would open to the last index that was saved with it.
User avatar
Scott
Site Admin
 
Posts: 1227
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: B27:Search Project

Postby codegreen » Wed May 10, 2017 10:39 am

IIRC it's a pretty simple matter to tweak Project Search to also point to the found instance:

First, click Options… and check Character Loc.

Then change the Script case in the mouseUp handler of the Edit Script btn as follows:

Code: Select all
      case "Script"
        if word 1 of tEntry <> "project" then
          do "put long id of"&&tEntry&&"of project tProj into tObj"
          if range = "" then edit the Script of tObj
          else edit the Script of tObj at char (word 2 of range)
        else if range = "" then edit the Script of (long name of proj tProj)
        else edit the Script of (long name of proj tProj) at char (word 2 of range)
        exit switch

Each match should now be listed separately in the Search Results field, and when one is double-clicked the script's insertion point should be at its first character.

Unfortunately due to structural limitations in the project file format, there's no way to select the range...

HTH,
-Mark
codegreen
 
Posts: 1529
Joined: Mon Jul 14, 2008 11:03 pm

Re: B27:Search Project

Postby sctell » Wed May 10, 2017 9:47 pm

codegreen wrote:IIRC it's a pretty simple matter to tweak Project Search to also point to the found instance:


Mark,

Thanks for this snippet, it will probably be worth adjusting the script at some point.

Could this be an option in the dialogue box or I suppose it will be necessary to make the adjustment at each BETA and future release points?

All the best

Terry
sctell
 
Posts: 1130
Joined: Sun Jul 06, 2008 10:41 am

Re: B27:Search Project

Postby codegreen » Wed May 10, 2017 10:58 pm

FWIW the RTE is basically Scott's bailiwick (I mostly just help stamp out the occasional brush fire).

But maybe if we ask him real nice... ;)

-Mark
codegreen
 
Posts: 1529
Joined: Mon Jul 14, 2008 11:03 pm


Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest