I've fixed this problem because, since I'm replacing hotkeys, I can specify '::' after the text to be replaced. However, I've found that the problem persists, because the text replacements don't happen all at the same time, but one after one, so as the script replaces text, it can replace what has already been replaced, so the result is wrong most of the times. I wonder how I could find a workaround for this. This is my script and the source file (simplified for testing):
-----
joy1::
joy2::
joy3::
joy4::
joy5::
joy6::
joy7::
joy8::
joy9::
joy10::
joy11::
Code:
inputbox, j1, Button configuration, Enter the number of your 1st button,,310,130
inputbox, j2, Button configuration, Enter the number of your 2nd button,,310,130
inputbox, j3, Button configuration, Enter the number of your 3rd button,,310,130
inputbox, j4, Button configuration, Enter the number of your 4th button,,310,130
inputbox, j5, Button configuration, Enter the number of your 5th button,,310,130
inputbox, j6, Button configuration, Enter the number of your 6th button,,310,130
inputbox, j7, Button configuration, Enter the number of your coin button (player 1),,310,130
inputbox, j8, Button configuration, Enter the number of your coin button (player 2),,310,130
inputbox, j9, Button configuration, Enter the number of your start button,,310,130
inputbox, j10, Button configuration, Enter the number of your pause button,,310,130
FileRead, text, source.txt
StringReplace, text, text, joy4::, joy%j1%::, All
StringReplace, text, text, joy1::, joy%j2%::, All
StringReplace, text, text, joy8::, joy%j3%::, All
StringReplace, text, text, joy3::, joy%j4%::, All
StringReplace, text, text, joy2::, joy%j5%::, All
StringReplace, text, text, joy6::, joy%j6%::, All
StringReplace, text, text, joy9::, joy%j7%::, All
StringReplace, text, text, joy7::, joy%j8%::, All
StringReplace, text, text, joy5::, joy%j9%::, All
StringReplace, text, text, joy10::, joy%j10%::, All
FileAppend, %text%, target.txt