mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
hey,

is there a way to replace all instances of $crlf in a file with <text>

i was looking at /filter, but it doesnt seem to have a <replacetext> item, any ideas how i could do this in the most efficient manner?


i was thinking /filter -if dialog id file $crlf <newtext>

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
I've never really used filter so I can't say much about it but you could maybe loop through the file or something and replace each instance of it that way.

$replace($read(...,%x),$crlf,<text>)

Or maybe File Handling, although I've not used that either. Sorry I couldn't be much help.

Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
yeah i realize that, but two key words: most efficient

looping through each line of text in a file isnt very efficient

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Again, I don't know if filter will do what you need, but if not, then load the text into a custom window and loop through that. It's much faster than doing it through the text file.


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
actually it takesfrom a dialog list and write to a file, for now i am having to use the loop, but i'm hoping for a faster more efficient way. is looping through a dialog listbox faster or slower then looping through a custom win?

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
don't you want to replace $crlf? $crlf separates lines in a plaintext file, so i don't know why we're discussing looping through lines with $replace and such :X

for generic 'replace text across a whole file' tasks i'd read the file into a binvar with /bread, then loop with $bfind and /bcopy. that would work even if you plan on involving $crlf in the replacement string


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde

Link Copied to Clipboard