mIRC Home    About    Download    Register    News    Help

Print Thread
Search/Replace on scripting menus... #145326 21/03/06 07:57 PM
Joined: Apr 2003
Posts: 18
K
Koji_Kabuto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Apr 2003
Posts: 18
This can't be too hard to make... heck, it'd probably be really easy, it would really help scripters if a Multi-Line search/replace option was added.

Maybe you could add a Button to switch between single/line + Recent queries and Multi-line searching.



Re: Search/Replace on scripting menus... #145327 22/03/06 01:37 AM
Joined: Apr 2003
Posts: 18
K
Koji_Kabuto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Apr 2003
Posts: 18
I didn't want to doublepost, but since it won't let me edit any longer... I post this because of the 26 views/no replies, I'm thinking maybe I wasn't completely clear on what I'm suggesting, I'm speaking of the Script editor here, so you could search/replace strings that span multiple lines.



Re: Search/Replace on scripting menus... #145328 22/03/06 02:25 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
As a (in my opinion) fairly decent scripter, this seems useless, as I've never found a need to search across multiple lines for a search & replace text. I'd say that probably 90% of the search and replaces that I do are things like changing $chan to %chan where %chan will be holding the channel or channels.

If I'm misunderstanding you, please provide an example of what you mean.

Also please note that 20+ views and no replies doesn't mean much, as if there are 20+ unregistered people that have viewed your post, the fact that they have viewed it will still be registered in the number of views, but since they are unregistered, they can not post a reply.

Re: Search/Replace on scripting menus... #145329 22/03/06 03:03 AM
Joined: Apr 2003
Posts: 18
K
Koji_Kabuto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Apr 2003
Posts: 18
Quote:
As a (in my opinion) fairly decent scripter, this seems useless, as I've never found a need to search across multiple lines for a search & replace text. I'd say that probably 90% of the search and replaces that I do are things like changing $chan to %chan where %chan will be holding the channel or channels.

If I'm misunderstanding you, please provide an example of what you mean.

Also please note that 20+ views and no replies doesn't mean much, as if there are 20+ unregistered people that have viewed your post, the fact that they have viewed it will still be registered in the number of views, but since they are unregistered, they can not post a reply.


Just wanted to make sure, because I sometimes write quite inintelligible crap... And that IS what I mean, for complex scripts it helps a lot, I personally have been coding a multiplayer game for a few years now, I had dropped the project due to various problems and decided to take it back up, so I had the need to replace some blocks of code repeated over and over with new, cleanlier and better code, and for not being able to do multi-line searching, it took me A LONG time.

And in any case, it'd be an option, so it wouldn't hinder functionality of actual system in any way I think. in fact, it should just be editting the dialog, I tried doing it with ResHacker, but either I [censored] up royally, mIRC is way too sensitive or it has an on-boot CRC-Check that prevented me from doing it. (The exe just didn't load, without giving any errors)

Last edited by Koji_Kabuto; 22/03/06 03:05 AM.
Re: Search/Replace on scripting menus... #145330 22/03/06 09:26 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I'm guessing you mean a block quote search replace

you are not wanting to find multiple instances of a single word and replace it but rather a block of text that may be (paragraphicly) on more than one line, and to find that whole block of text and replace it.

such as
if (blah iswm %blah) { do stuff }
if (day == sunny) { walk the dog }

then highlite both lines and replace it with two whole lines that are totally or significantly different

edit:
I can see where rarely this could have been helpful, such as having done some dialog that needed the same code in several places, and I had gotten to the third one before realizing I should do the functional stuff as an alias. then to find a block of code and replace it with an alias name enmass would have been ok
had I gotten to where i had 10 things that took very similar code and gotten to the 10th before seeing how i should have done an alias to do that and then having a block quote/replace would really make my day.

so I'm in support of the idea, but i just don't have it happen that much.

Last edited by MikeChat; 22/03/06 09:32 PM.
Re: Search/Replace on scripting menus... #145331 23/03/06 02:39 AM
Joined: Apr 2003
Posts: 18
K
Koji_Kabuto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Apr 2003
Posts: 18
I have this script with about 15k lines of text, that I coded like 4 years ago, so go figure. :P



Re: Search/Replace on scripting menus... #145332 24/03/06 04:35 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
I poked around (very little) and none of the text programs I have will do block quote/replace

I dont have super notepad or any of the other notepad replacements but maybe one of those will allow that.

Re: Search/Replace on scripting menus... #145333 24/03/06 07:40 PM
Joined: Jul 2003
Posts: 655
Om3n Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
I use ultraedit for a lot of non mirc coding, and even that doesn't support such a thing...

Anyway, i would like to make a semi unrelated suggestion... maybe your code would be significantly smaller (and maybe prevent the need for such a feature) if you made good use of aliases setup as functions, rather than endlessly repeating portions of code.

Personally if i use a multi line snippet of code more than twice, i make a point of creating an alias to be called instead. (such as endlessly checking if the channel an event occured in matches a list, or if a variable is valid, etc)


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Re: Search/Replace on scripting menus... #145334 25/03/06 12:06 AM
Joined: Apr 2003
Posts: 18
K
Koji_Kabuto Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Apr 2003
Posts: 18
Oh, but I do use that, it's 15k lines in aliases that I've got.

Also, Editplus does multi-line as well as REGEX replacing.



Re: Search/Replace on scripting menus... #145335 25/03/06 04:20 AM
Joined: Jul 2003
Posts: 655
Om3n Offline
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
My point was that if you do it effectively you should only ever need to replace a portion of code in 1 or 2 places, because you wont have endless duplicates of code through the script.

Think of it like using functions in php (procedures in tcl, and so on), if your familiar with them.

Anyway, it could be useful in a very few and rare circumstances, but for the most part smart code organization should eliminate the need for quote replace.

(i use grep replace in ultraedit all the time, but as much as i use its replace features i have never come across a need for quote replace personally)


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby