Opened 10 years ago

Last modified 3 years ago

#2652 assigned Feature Request

Allow ExpandVarStrings to expand com properties as well.

Reported by: this-is-me Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:


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)};")

$vars = JSON('{' & _
'"widget": {' & _
'    "debug": "on",' & _
'    "window": {' & _
'        "title": "Sample Konfabulator Widget",' & _
'        "name": "main_window",' & _
'        "width": 500,' & _
'        "height": 500' & _
'    }' & _
'}' & _


Func JSON($def = "{}")
    $objJSONScript.Eval("var z=" & StringReplace($def, "\", "\\"))
    Return $objJSONScript.Eval("z")
EndFunc   ;==>JSON

Attachments (1)

113.au3 (1.4 KB) - added by anonymous 5 months ago.

Download all attachments as: .zip

Change History (2)

comment:1 Changed 3 years ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

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

Changed 5 months ago by anonymous

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

as assigned The owner will remain Jpm.

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

Note: See TracTickets for help on using tickets.