Hi PsaltyDS, and thanks for your ongoing assistance.
I'm still having problems assigning to a property/variable using Execute().
I've broken it down into the simplest code
Global $sum = 0
;doesn't work
modify("$sum")
func modify($var)
Execute($var & " = 5")
MsgBox(0,"", $sum) ;0 is displayed
EndFunc
;End doesn't work
;works
modifyWorking("sum")
func modifyWorking($var)
Assign($var, "5")
MsgBox(0,"", $sum) ;5 is displayed
EndFunc
;end works
$a=1
$v=Execute("$a=2")
MsgBox(0,"", $v) ;False is displayed because 1 <> 2, so the execute is doing a comparison rather than an assignment.
#cs
;Example taken from code I am trying to achieve.
$sPropertyToEdit = "Keywords"
$sPropertyToAdd = "Test"
$propToExecute = "$objFile.SummaryProperties." & $sPropertyToEdit
Local $bool = Execute($propToExecute & " = " & $sPropertyToAdd)
msgbox(0,"", @error) ;@error shows 1, $bool is blank
#ce
#cs
Local $bool = Assign("objFile.SummaryProperties." & $sPropertyToEdit, $sPropertyToAdd) ;note missing dollar sign for objFile as per example in help
msgbox(0,"", $bool) ;shows 1, but value hasn't been updated.
#ce
#cs
Local $bool = Assign("$objFile.SummaryProperties." & $sPropertyToEdit, $sPropertyToAdd)
msgbox(0,"", $bool) ;shows 1, but value hasn't been updated.
#ce
I would be delighted to get this working, but I don't have any experience with execute/eval/assign.