mIRC Homepage
Posted By: Koji_Kabuto Search/Replace on scripting menus... - 21/03/06 07:57 PM
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.
Posted By: Koji_Kabuto Re: Search/Replace on scripting menus... - 22/03/06 01:37 AM
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.
Posted By: RusselB Re: Search/Replace on scripting menus... - 22/03/06 02:25 AM
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.
Posted By: Koji_Kabuto Re: Search/Replace on scripting menus... - 22/03/06 03:03 AM
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)
Posted By: MikeChat Re: Search/Replace on scripting menus... - 22/03/06 09:26 PM
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.
Posted By: Koji_Kabuto Re: Search/Replace on scripting menus... - 23/03/06 02:39 AM
I have this script with about 15k lines of text, that I coded like 4 years ago, so go figure. :P
Posted By: MikeChat Re: Search/Replace on scripting menus... - 24/03/06 04:35 AM
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.
Posted By: Om3n Re: Search/Replace on scripting menus... - 24/03/06 07:40 PM
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)
Posted By: Koji_Kabuto Re: Search/Replace on scripting menus... - 25/03/06 12:06 AM
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.
Posted By: Om3n Re: Search/Replace on scripting menus... - 25/03/06 04:20 AM
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)
© mIRC Discussion Forums