txt.replace - interactively replace a character with another

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
davebrny
Posts: 85
Joined: 05 Dec 2016, 06:26

txt.replace - interactively replace a character with another

17 Jun 2019, 10:47

change selected text from something like "one.two.three" to "one_two_three" or "one two three"

usage
- select some text
- press alt + r
- first press the character you want to replace, then the character you want to add in its place
- press enter to paste the new text
- (press esc at any time to close the interactive tooltip)

- use alt+shift + r to repeat the last replace without showing the tooltip


related scripts:
txt.swap - interactively swap text at a certain character or word
txt.wrap - wrap selected text in *symbols*
burque505
Posts: 1736
Joined: 22 Jan 2017, 19:37

Re: txt.replace - interactively replace a character with another

17 Jun 2019, 13:10

@davebrny, thanks for the script. Just tried it out replacing periods with underscores in file names, works great.
Regards,
burque505
User avatar
davebrny
Posts: 85
Joined: 05 Dec 2016, 06:26

Re: txt.replace - interactively replace a character with another

17 Jun 2019, 14:25

youre welcome @burque505. ive mostly been using it on files as well
zhotkey
Posts: 14
Joined: 21 Jun 2017, 08:22

Re: txt.replace - interactively replace a character with another

18 Jun 2019, 07:35

I get the following Error: Call to nonexistent function: selected := selected_text_r()
User avatar
davebrny
Posts: 85
Joined: 05 Dec 2016, 06:26

Re: txt.replace - interactively replace a character with another

18 Jun 2019, 08:16

zhotkey wrote:
18 Jun 2019, 07:35
I get the following Error: Call to nonexistent function: selected := selected_text_r()
maybe you copy-pasted the script and missed the end of the file? there should be 89 lines in the file altogether
zhotkey
Posts: 14
Joined: 21 Jun 2017, 08:22

Re: txt.replace - interactively replace a character with another

18 Jun 2019, 11:36

Your correct, my bad, works like a charm!
User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: txt.replace - interactively replace a character with another

25 Jun 2019, 00:16

Man! This is awesome. I've been using Notepad++ to paste into, do a Find and Replace, then copying and pasting the content back to where i needed it. This is way faster!
User avatar
davebrny
Posts: 85
Joined: 05 Dec 2016, 06:26

Re: txt.replace - interactively replace a character with another

26 Jun 2019, 05:22

Thoughtfu1Tux wrote:
25 Jun 2019, 00:16
Man! This is awesome. I've been using Notepad++ to paste into, do a Find and Replace, then copying and pasting the content back to where i needed it. This is way faster!
ha, ive been just doing it manually for as long as i can remember. all those wasted seconds would probably add up to a lot at this point!
terjene
Posts: 1
Joined: 12 Sep 2019, 06:22

Re: txt.replace - interactively replace a character with another

12 Sep 2019, 06:29

Nice script!
I would like to modify it a bit. I want to search for {enter} and replace with multiple characters.
I thought if {enter} was pressed during "replace", then search for enter, and allow "with" to be several characters, until enter is pressed.
Do you have any hints?

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: sanmaodo and 170 guests