ああ、私もその問題を抱えていました。だから私はこの関数を作成し、ahk ライブラリに保持します。
;simply enclose the text in double-quotes
;if you set mode, the string is surrounded by doubled double quotes
enc(whattext, mode=0){
global a_doublequote
if(mode){
quotedvar = "%a_doublequote%%whattext%%a_doublequote%"
}else{
quotedvar := a_doublequote . whattext . a_doublequote
}
return quotedvar
}
出力は次のとおりです。
testphrase = george
msgbox % enc(testphrase)
;==> "george"
msgbox % enc(testphrase, true)
;==> ""george""
割り当てで行っていることは、
pmsg.Subject := "%subject%":=
の値を持つ文字列を作成することです%subject
ただし、次のようにするとうまくいきます。
pmsg.Subject = "%subject%"
割り当てを使用すると:=
、Javascript などの他のコーディング言語と同じ方法で変数が割り当てられます。を使用すると、そのモードでの変数の割り当てを示す=
を除いて、変数はリテラル モードで割り当てられ%
ます。