I have a lot of strings I need to perform substitutions on. So, instead of having like 20 lines such as
Code: Select all
Target:=StrReplace(Target, "retire", "quite")
Target:=StrReplace(Target, "entrada", "admisión")
Target:=StrReplace(Target, "arnés", "mazo de cables")
Target:=StrReplace(Target, "tornillo", "perno")
Target:=StrReplace(Target, "ntos de tubos", "ntos de tubo")
Target:=StrReplace(Target, "con un par de apriete", "a un par de")
Code: Select all
Replacements = retire:quite
,entrada:admisión
,arnés:mazo de cables
,tornillo:perno,
ntos de tubos:ntos de tubo
,con un par de apriete:a un par
Code: Select all
Replacements:={"retire":"quite"
,"entrada":"admisión"
,"arnés":"mazo de cables"
,"tornillo":"perno"
,"ntos de tubos":"ntos de tubo"
,"con un par de apriete":"a un par de"}
Target:=RegexReplace(Target,"\b" . Word1 . "\b",Word2) to make all the necessary changes to the strings I get as a "Target".
The thing is, after modifying the variable, adding inverted commas and braces in the right places and whatnot, Replacements is NOT CONSIDERED an array, how the heck do I tell autohotkey to consider it as an asociative array and NOT as a literal string???
This is my entire code where you can see the process step by step
Code: Select all
Replacements =retire:quite,entrada:admisión,arnés:mazo de cables
,tornillo:perno,ntos de tubos:ntos de tubo
,con un par de apriete:a un par
Replacements :=RegexReplace(Replacements , ":",""":""") ; changes : to ":"
Replacements :=RegexReplace(Replacements , ",", """,""") ; changes , to ","
Replacements :=RegexReplace(Replacements ,"(.)\z", "$1""}") ; changes the last letter of the string to letter"}
Replacements :=RegexReplace(Replacements ,"^(.)", "{""$1") ; changes the first letter of the string to {"letter
Array= %Replacements%
MsgBox,Array %Array%
; And here I am stuck because I can't use the For loop because Array is NOT an array
Any help?