Perspective - Absolute Newb Question - Making one button simultaneously stop 4 different conveyor systems

I’m trying to do it by toggling 4 different bits with “onMouseDown” & “onMouseUp” event scripts.

These are the Tag Paths (Copied & Pasted from each individual tag)

  • [default]CCP61/CCP61_stop
  • [default]CCP62/CCP62_stop
  • [default]CCP63/CCP63_stop
  • [default]CCP71/CCP71_stop

I have tried this: :arrow_down:, Adding a separate script for each tag but I keep getting the red squiggly underline and a "no viable alternative at input ‘CCP61’ " message when I hover the cursor over the text.

Your tag adress is a string, so you need to write that line like this:

system.tag.write('[default]CCP71/CCP71_stop',1)

You can also write all of them at the same time using system.tag.writeAsync()

tagList = ['[default]CCP71/CCP71_stop',
			'[default]CCP63/CCP63_stop',
			'[default]CCP63/CCP63_stop',
			'[default]CCP61/CCP61_stop']
valuesList = [True,True,True,True]
system.tag.writeAsync(tagList,valuesList)

So you can just provide a list of tag paths and values and do it all at once, efficiently.
You can take a better look at how it works here:
https://docs.inductiveautomation.com/display/DOC81/system.tag.writeAsync

1 Like

I’ve eddited on my response, but since you’re toggling bits, you can’t write "1" to them, since you’re indicating that that 1 is actually a string, the correct way would be to just use 1 or True

2 Likes

So for now I used a separate script for each tag using system.tag.write(). I couldn’t get system.tag.writeAsync() to work. Thank You

Just so you know, system.tag.write is now deprecated. system.tag.writeBlocking or system.tag.writeAsync should be used.

Ps you can simplify this to:

system.tag.writeAsync(tagList, [True]*len(tagList))

Just fyi this only applies to v8+ and not to v7 which is propably why these new functions aren't working for the OP

1 Like

Of course and useful for others to distinguish between, but screenshot is from V8

1 Like

Haha, that’s embarrassing, I didn’t even look at the screenshot :roll_eyes:

2 Likes

Thank You guys!!