AHK script to remove smart quotes (comillas "inteligentes")

Working my way through the RPA Developer Manual (English), I was cutting-and-pasting CartesScript code from the manual into RPA Developer, and couldn’t figure out why nothing was running.

The culprit? “Smart” quotation marks (o sea, si no me equivoco, comillas dobles inteligentes/rizadas).

This code - so simple - wouldn’t run (note the curly quotes):

function notepadWrite($text){
Global $Notepad;
if (not($Notepad.componentExist))
run(“notepad.exe”);
$Notepad.value($text);
}
notepadWrite(“Hello world”);

I needed to turn it into this:

function notepadWrite($text){
Global $Notepad;
if (not($Notepad.componentExist))
run("notepad.exe");
$Notepad.value($text);
}
notepadWrite("Hello world");

Doing that manually is no fun. I wrote this brief AutoHotkey script that converts the quotation marks to “straight” quotes and changes Unix Lf into Windows CrLf. At the moment I haven’t expanded it to be able to convert single ‘smart’ quotes, if for no other reason than I haven’t run across any in the manual so far. It would also be nice to choose whether to use Unix or Windows line feeds also. In the future … for now it is just to get me through the manual.

AHK code:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Gui, Font, s16
Gui, Add, Edit, w600 h600 vTooSmart, Paste your text with smart quotes here.
Gui, Add, Button, Default, Submit
Gui, Show, , Smart Quote Killer

return

    ButtonSubmit:
    Gui, Submit, NoHide
    killit := TooSmart
    killit := StrReplace(killit, "`n", "`r`n")
    killit := StrReplace(killit, "“", """")
    killit := StrReplace(killit, "”", """")
    ControlSetText, Edit1, %killit%
    Gui, Submit, NoHide
    return

    GuiClose:
    !Escape::
    ExitApp

I hope this helps someone, please let me know if it doesn’t work for you.

Regards,
burque505