zoltan
December 7, 2021, 12:32pm
1
Hi,
in a button scripting property I have this line :
send('/adm/obj/@{switch_source_select_v4.value}/dump')
send('/adm/obj/@{switch_source_select_v5.value}/dump')
in the console I get this message "script syntax error : using advanced syntaxes in the script property is strongly discouraged and may result in unexpected behaviors"
I have same log with XY & multi XY widgets and script.
Btw all is working perfectly fine
I don't know how to make this clearer, it's also written in the docs, : avoid using @{} in scripts, use get()
instead.
2 Likes
zoltan
December 7, 2021, 6:11pm
3
I'm sorry I used get everywhere else ^^'
zoltan
December 7, 2021, 8:01pm
4
@jean-emmanuel I'm sorry again I remember why I used @{} when using get() I didn't managed to make it worked
send('/adm/obj/get('switch_source_select_v2')/x', value[0])
Hello @zoltan . Try using concatenation, like this:
const switchValue = get('switch_source_select_v2')
send('/adm/obj/' + switchValue + '/x', value[0])
or using template literals:
const switchValue = get('switch_source_select_v2')
`send('/adm/obj/${switchValue}/x', value[0])`
1 Like