Search & Replace being a bit unhelpful

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

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

Search & Replace being a bit unhelpful

Post by richmond62 » Sun Jan 09, 2022 3:28 pm

search&rep.jpg
-
This is both odd and a pain-in-the-bum:

1. The button script contains significantly more than 1 incidence of the search phrase.

2. I wish to replace that search phrase, but am unable to do that owing to only one incidence being reported.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Search & Replace being a bit unhelpful

Post by Klaus » Sun Jan 09, 2022 3:36 pm

I used the "Find and Replace" dialog just yesterday.

Yes, it does not report how many occurrences of your string were found, only where these werde found!
But will reliably replace all occurrences in the found script(s)!

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Sun Jan 09, 2022 3:42 pm

Thank you very much. 8)
werde
It does, indeed, replace aa the vocables.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Search & Replace being a bit unhelpful

Post by Klaus » Sun Jan 09, 2022 3:44 pm

Yep, a little typo...

But please just try it next time, I can assure, your machine will not explode! 8)

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Sun Jan 09, 2022 3:49 pm

Thanks, Klaus, it warks byously. 8)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Search & Replace being a bit unhelpful

Post by dunbarx » Sun Jan 09, 2022 4:18 pm

Richmond.

Here is a stack that does what you want. It loses all instances of "good men" in a field of text. Follow the button script...

Craig
LoseString.livecode.zip
(1.21 KiB) Downloaded 179 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Search & Replace being a bit unhelpful

Post by dunbarx » Sun Jan 09, 2022 4:20 pm

Ah. did not see Klaus' post.

You can get the number of occurrences in mine by finding the number of lines of the variable "findList".

Craig

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

Location of Search & Replace stack.

Post by richmond62 » Wed Jan 12, 2022 9:33 am

I should like to extend and colourise the
Find and Replace stack as:

1. I find the white-on-white tough on my eyes.

2. I would like a significantly longer textField for the Replace phrase.

But I cannot locate the stack . . .
-
SShot 2022-01-12 at 10.38.16.png
-
I mean the right-hand stack.

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Wed Jan 12, 2022 9:43 am

Come to think of things . . .

. . . a tree diagram of all the stacks inwith the LC IDE would be extremely useful.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Search & Replace being a bit unhelpful

Post by bn » Wed Jan 12, 2022 10:08 am

But I cannot locate the stack . . .
The stack is called "revSearch" and is located within the app bundle on Mac:

/Users/userName/Applications/LiveCode 9.6.6 (rc 1).app/Contents/Tools/Toolset/palettes/revsearch.rev

Kind regards
Bernd

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Wed Jan 12, 2022 10:11 am

That's super: Thank you very much.

I was looking for it using the Application Browser and getting nowhere. :?

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Wed Jan 12, 2022 10:26 am

Thank you once again.
-
SShot 2022-01-12 at 11.25.15.png
-
This modified stack is derived from the Open Source version of LC 9.6.3
Attachments
revsearch.rev.zip
Here's the stack.
(39.17 KiB) Downloaded 182 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Search & Replace being a bit unhelpful

Post by bn » Wed Jan 12, 2022 10:50 am

I was looking for it using the Application Browser and getting nowhere. :?
When the stack is open it shows up in the Project Browser. The trick is to know the name

For that I use from the message box

Code: Select all

put the name of the mouseStack 
then move the cursor over the stack and hit return.

For the location the same procedure as above but

Code: Select all

put the long name of the mouseStack
Kind regards
Bernd

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Wed Jan 12, 2022 1:15 pm

The trick is to know the name
Ain't dat de trouf bwana. 8)

Your messageBox 'trick' is pure gold: Thanks.

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

Re: Search & Replace being a bit unhelpful

Post by richmond62 » Wed Jan 12, 2022 1:26 pm

Screen Shot 2022-01-12 at 2.23.07 PM.png
-
Change colours to suit your personal level of X£%VG&*
Attachments
revsearch.rev.zip
Stack
(39.57 KiB) Downloaded 172 times

Post Reply