Modify

Opened 7 years ago

Last modified 7 months 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:

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 (1)

comment:1 Changed 7 months ago by Jpm

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

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

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 assigned The owner will remain Jpm.
Author


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

 
Note: See TracTickets for help on using tickets.