Modify

Opened 6 years ago

#2652 new Feature Request

Allow ExpandVarStrings to expand com properties as well.

Reported by: this-is-me Owned by:
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 (0)

Change History (0)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.