Modify ↓
Opened 12 years ago
Last modified 2 years ago
#2652 assigned Feature Request
Allow ExpandVarStrings to expand com properties as well.
| Reported by: | this-is-me | Owned by: | Jon |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | Cc: |
Description
The ExpandVarStrings option does not currently expand if the variable is actually a com property. It would be nice if expansion could happen on these properties as well.
Opt("ExpandVarStrings", 1)
Global $objJSONScript = ObjCreate("ScriptControl")
With $objJSONScript
.language = "Jscript"
.AddCode("Array.prototype.item=function(i){return this[i]};Object.prototype.item=function(i){return this[i]};Object.prototype.addProp=function(prop,val){eval('this.'+prop+'='+val)};")
EndWith
$vars = JSON('{' & _
'"widget": {' & _
' "debug": "on",' & _
' "window": {' & _
' "title": "Sample Konfabulator Widget",' & _
' "name": "main_window",' & _
' "width": 500,' & _
' "height": 500' & _
' }' & _
'}' & _
'}')
MsgBox(0,"",$vars.widget.window.title)
MsgBox(0,"","$vars.widget.window.title$")
Func JSON($def = "{}")
$objJSONScript.Eval("var z=" & StringReplace($def, "\", "\\"))
Return $objJSONScript.Eval("z")
EndFunc ;==>JSON
Attachments (1)
Change History (3)
comment:1 by , 5 years ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
by , 3 years ago
comment:2 by , 2 years ago
| Owner: | changed from to |
|---|
Note:
See TracTickets
for help on using tickets.

Hi,
I introduce a new option to expand expression
Opt("ExpandExpStrings", 1)
to expand string containing expression such as "($vars.widget.window.title)"
a COM evariable must be evaluated before it can be used.
Fix sent to Jon