Mouse click tag write

Yes, the return would work inside a function (which you could do using “def”). Or you could do it like this (after all the elifs):

if equipmentChoice == -1:
   system.gui.messageBox("You must choose the equipment before writing a value", "Choose equipment")
else:
   system.tag.write(tagName, value)

When you’re scripting, if you’re not familiar with Python but hopefully are familiar with some programming language, just search “Python [whatever it is you’d use in the language you’re familiar with]” and you should find examples of how to create the logic you’re looking for in Python.

I am new to the scripting side. Trying to learn as I go. still no tag write.

but no error on tagName!

As a rule, if your script isn’t working, break it down into parts and test them to find out where it is failing. And/or add print/system.gui.messageBox along the way to check values as you did above.

If you’re still clearing selectedValue in the dropdown before you read it in this script (getting -1 in script), it is expected that this script will not write a tag. Without a valid selection from dropdown it doesn’t know what tag to write to.

If you’re not familiar with any scripting language (hard for me to relate as I was coding in basic on a monochrome computer with a few KB of memory when 6 years old), you’ll likely still have some luck finding what you’re looking for by searching the internet for “How to _________ Python”. Any scripting in Ignition besides SQL statements will be Python and Java. As they are common outside Ignition, much of what you need will be found from other sources.

ok, Thanks for all the Help. It is working now! II have been doing PLC programming for several years now. Since getting Ignition it has opened a whole new world of programming Sql and Python.

Cool; glad you’ve got it working. Python and Java were new to me with Ignition, but with a few pointers here and realizing there’s lots of info on them elsewhere it’s possible to do just about anything in Ignition. Have fun!

I guess you get it working, however the only thing a don’t see in the posts is the Tag Provider with the tag path. For Ignition defined tags under the default provider should look something like this.

system.tag.write(‘[default]path/to/tag’)

Hope this is useful in any future needs.