replace character in window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
GingerMoose
Posts: 2
Joined: 20 Sep 2017, 13:53

replace character in window

20 Sep 2017, 14:04

Sorry if this seems painfully simple, but I need a script that changes / to - in the active window. The program software that it's for already contains something that changes the - to / and the programmers can't be bothered to fix it. So something that automatically does it based on window title might not be the best option without a timer. Other option is using a keyboard key to activate it. I'm just having trouble with the activation of the StringReplace function and how it actually fits in with the rest of the script... Can anyone please help?
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: replace character in window

20 Sep 2017, 15:00

Hi.
The helpfile shows

Code: Select all

StringReplace, OutputVar, InputVar, SearchText [, ReplaceText, ReplaceAll?]
You have to change to this:

Code: Select all

StringReplace, OutputVar, InputVar, /, -, A
Note, that you have to copy your text into the variable called InputVar.
BTW - posting your script could generate more sensible support.
Einfach nur ein toller Typ. :mrgreen:
GingerMoose
Posts: 2
Joined: 20 Sep 2017, 13:53

Re: replace character in window

20 Sep 2017, 15:34

I have no script really... I just want to press a key like an F key or something and replace / with - in the open program window. But not sure how to start.
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: replace character in window

21 Sep 2017, 02:19

Hallo,
try this at your own risk! Hotkey: Control + Minus

Code: Select all

GroupAdd, Better_Not, ahk_class CabinetWClass
GroupAdd, Better_Not, ahk_class ExploreWClass
GroupAdd, Better_Not, ahk_class Progman
GroupAdd, Better_Not, ahk_class WorkerW
#IfWinNotActive, ahk_group Better_Not
^-:: ;Hotkey: Control + Minus
^NumpadSub::
	ClipOld := ClipboardAll
	Clipboard =
	SendInput, ^a
	Sleep, 100
	SendInput, ^c
	ClipWait, 1
	IF !Errorlevel
	{
		StringReplace, Clipboard, Clipboard, /, -, A
		SendInput, ^v
		Sleep, 100
	}
	Clipboard := ClipOld
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, mikeyww, sanmaodo and 255 guests