Using a tagpath variable inside of a button script

I have created a dynamic "settings" popup window. I have succesfully used the {tagpath} variable function to select the proper A or B tag variant for all of the relevant data except for a "start" and "stop" button. When pressing the button I need the value of 14 to be written to the tag, but I need it to dynamically change the tag based upon the {tagpath} data. In scripting here is what I have...

selector = event.source.parent.tagpath
value = 14
system.tag.writeBlocking(['Compressor[selector]/Command'], [value])

I know this is something simple I'm just glossing over but can't get through my skull this morning.

'Compressor[selector]/Command'

This is just a string. You will need to build the path, something like this:

'Compressor' + selector + '/Command'

And... welcome to the forum!!

I knew it was something I was just glossing over.

Thank you!

1 Like