Can I make a script to find/replace?

Type2Work

Active Member
Contributor
Joined
Jan 19, 2016
Messages
787
Reaction score
1,104
Points
468
Gender
Female
Can I make a script to make changes to text that I am making over and over, just like macros in Word to find and replace all occurrences?
Is this possible with AHK or user scripts?
 

clickhappier

┬──┬ ノ( ゜-゜ノ)
Subforum Curator
Crowd Pleaser
Joined
Jan 12, 2016
Messages
728
Reaction score
1,634
Points
593
Location
USA
Can I make a script to make changes to text that I am making over and over, just like macros in Word to find and replace all occurrences?
Is this possible with AHK or user scripts?
Yes, it's possible, but more context would be needed to say how.
 

TSolo315

SnapNCrackle
Administrator
Joined
Jan 12, 2016
Messages
5,000
Reaction score
16,975
Points
2,538
Gender
Male
Sounds very doable with AHK.
 
  • Like
Reactions: Type2Work

Type2Work

Active Member
Contributor
Joined
Jan 19, 2016
Messages
787
Reaction score
1,104
Points
468
Gender
Female
Yes, it's possible, but more context would be needed to say how.
Sounds very doable with AHK.
I'm doing hits where I am editing in a text field. I tried looking up search and replace for AHK and found a lot of threads that seem to be about running a script that finds a file on your computer and makes the changes there. I'd like to do it in the browser. I'll try to keep looking around with AHK, maybe just not searching the right terms.
 

DCI

Well-Known Member
Joined
Jan 14, 2016
Messages
1,997
Reaction score
6,223
Points
763
Age
46
Location
212
Gender
Male
If you're editing text in a text field, the easiest way to do it in ahk would probably be to make a hotkey that selects all, copies to clipboard, searches string on clipboard for text and replaces with other text, then pastes.

https://autohotkey.com/docs/commands/StringReplace.htm

Code:
~::
send ^a
send ^c
ClipWait
StringReplace, clipboard, clipboard, Kansas basketball, lol, All
send ^v
return
^will change all instances of the text "Kansas basketball" to "lol" when you press ~ inside of the text field. Not case sensitive.
 
Last edited: