I re-wrote this script here after finding that it sometimes goes into a infinite loop (and crashes my installer)
Right now, I found out that it never replaces the last occurence of text, no matter what I do.
I'm currently using:
Push "cls$\r$\n"
Push ""
Push "1"
Push "all"
Push "${INSTDIR}\compile.bat"
Call AdvReplaceInFile
So, my script will use these and it should replace like so...
cls$\r$\n
cls$\r$\n
cls$\r$\n
cls$\r$\n
...becomes...
cls$\r$\n
cls$\r$\n
See that it always leaves another "cls$\r$\n" on the end, when it is not meant to.
Can anyone find out what is either wrong with the script, or what I should do to fix this problem.
Thanks
-Stu
Edit:
I think it would be a good idea to add a "Text file manipulation" directory on the archive, unless it's ok that I create one myself?
Help with my function
14 posts
You are more than welcome to create directories yourself. Do whatever you want, if you're not allowed the Archive should stop you 🙂 (don't quote me on that :P)
Ok thanks 🙂
I'm still not sure why it is not writing the last line down though (or removing it in my case)
Maybe it's just because in the example I was testing under, it's because it is the last line of the file, and IfErrors is bypassing it.
-Stu
I'm still not sure why it is not writing the last line down though (or removing it in my case)
Maybe it's just because in the example I was testing under, it's because it is the last line of the file, and IfErrors is bypassing it.
-Stu
How would I go about adding a subdir within the "Useful Functions" section?
I would like to add "Text file manipulation" as a subsection within the "Useful Functions" section.
Sorry if I am sounding stupid, but I don't want to make a mess of anything 😛
-Stu 🙂
I would like to add "Text file manipulation" as a subsection within the "Useful Functions" section.
Sorry if I am sounding stupid, but I don't want to make a mess of anything 😛
-Stu 🙂
To add a directory to the archive go to Contribute and choose "a new section that can contain other pages."
I'll have a look at the script and tell you if I find anything.
I'll have a look at the script and tell you if I find anything.
I think the problem in the script is in the loop_filter label. The first comparison you do there is with a copy of $7 minus the last character. While this will work for lines where the last character is not a line break it won't work for the last line that probably doesn't have a line break after it.
You are right!
Anyone know how I would go about fixing this?
Edit: Made the new section, and put all the scripts in.
Could somone delete the old ones for me?
-Stu
Anyone know how I would go about fixing this?
Edit: Made the new section, and put all the scripts in.
Could somone delete the old ones for me?
-Stu
Afrow, just start the counter from -1 🙂
About the sections in the archive you should be able to delete the instances yourself assuming the pages were created by you.
About the sections in the archive you should be able to delete the instances yourself assuming the pages were created by you.
I have went ahead and did it myself since not all of the pages were yours.
LOL
I was able to insert other peoples' pages into my section, but I couldn't delete the old ones (made by me) because it said I need administrator rights!
Edit; ok I changed StrCpy $5 -1 and it still doesn't work, unless you mean something else?
-Stu 🙂 😛
I was able to insert other peoples' pages into my section, but I couldn't delete the old ones (made by me) because it said I need administrator rights!
Edit; ok I changed StrCpy $5 -1 and it still doesn't work, unless you mean something else?
-Stu 🙂 😛
Oops, should be 1. You decrease it by one, not increase.
Yes, thats what I thought.
The only thing is, once $5 becomes 0, doesn't $6 become ""?
-Stu
The only thing is, once $5 becomes 0, doesn't $6 become ""?
-Stu
No since 0 is the same as "" and is the same as not specifying anything which never results in "".
It didn't work using $5 as 1, it stops any lines being changed in the file at all.
The function is pretty much ok
-Stu
The function is pretty much ok
-Stu