我正在尝试为数组指定十六进制颜色值。这是不可能的,因为当我分配值时,它会更改为数字。以下是执行此操作的代码:
settings := {myColor: "color"}
myColor := "color"
settingName := "myColor"
settingValue := "0x00FF00"
%settingName% := settingValue
settings[settingName] := settingValue
e := settings[settingName]
MsgBox %e% - %settingValue%
;Displays 65280 - 0x00FF00
答案 0 :(得分:0)
我认为你在第5行代码中出错了。您定义的变量不会获得%sign。
settings := {myColor: "color"}
myColor := "color"
settingName := "myColor"
settingValue := "0x00FF00"
settingName = %settingValue% ; Alternative 1
settingName := settingValue ; Alternative 2
settings[settingName] := settingValue
e := settings[settingName]
MsgBox % e " - " settings[settingName] " - " settingValue
;Displays 0x00FF00 - 0x00FF00 - 0x00FF00
ExitApp
虽然我认为你想要:设置[MyColor] = 0x00FF00,你现在有设置[0x00FF00] = 0x00FF00。
settings := {myColor: "color"}
myColor := "color"
settingName := "myColor"
settingValue := "0x00FF00"
settings[settingName] := settingValue
MsgBox % settings[settingName] " - " settingValue
;Displays 0x00FF00 - 0x00FF00
ExitApp