3

Trying do do a simple

StringReplace, clipboard, clipboard, \, /, All

That code works w/ other characters, but gives an error with '\' and/or '/' also tried ASCII codes but those do not work either since % is a variable in AHK.

How to StringReplace a '\' with AutoHotkey?

This_Is_Fun
  • 183
  • 3
  • 12

2 Answers2

3

I get no error using that line. I used the following snippet to test:

CapsLock & p::
clipboard = are\there\backslashes?
MsgBox, %clipboard%
StringReplace, clipboard, clipboard, \, /, All
MsgBox, %clipboard%
return 

I'm using AutoHotKey 1.0.46.1 (which is probably old by now...) on a Windows XP laptop.

What version are you using?

yhw42
  • 3,334
  • 2
  • 27
  • 24
0

If you are using \ as the escape character

#EscapeChar \

then the code should be

StringReplace, clipboard, clipboard, \\, /, All
Daniel
  • 21
  • 1