Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

  • Explore the new navigation for even easier access to your community.
  • Bookmark and use our new, easy-to-remember address (community.se.com).
  • Get ready for more content and an improved experience.

Contact SchneiderCommunity.Support@se.com if you have any questions.

Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel

[Imported] Simple? Button Script

EcoStruxure Geo SCADA Expert Forum

Find out how SCADA systems and networks, like EcoStruxure Geo SCADA Expert, help industrial organizations maintaining efficiency, processing data for smarter decision making with IoT, RTU and PLC devices.

Janeway Janeway

[Imported] Simple? Button Script

>>Message imported from previous forum - Category:Scripts and Tips<<
User: admin, originally posted: 2018-10-25 18:29:54 Id:267
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.


Using a button symbol with parameters and this is as close as I can get to the correct PickParam, no errors when clicked but nothing happens:
'Server.SetOPCValue "' + "Parameter:A On CMD Tag.CurrentValue" + '", 1'
This one works on the main screen whereas the above imbedded one will not:
'Server.SetOPCValue "RRC WWTP.Process Screens.Overview.Lift Station 1.I/O.SCADA Timer Mode.CurrentValue", 1'
This is with PickType 20 for script.
I have this one for PickType 5 Method that works:
"Parameter:A Start CMD Tag.ObjectLink" + '?Control&CurrentValue'
All the back and forth makes it reall hard to see what is going on. I'd love to see the PickParam string that comes out and then I could maybe fix it._**


I guess you can kind of see what it is doing by looking at the Pick Action. I did not put it there but it looks like it shows you the string without the parameters.
Server.SetOPCValue "", 1_**


Seems like I'm almost there but something is still not right.
'''Server.SetOPCValue "' + "Parameter:A On CMD Tag.ObjectLink" + '.CurrentValue' + '", 1'''
Gets me this and no errors but it don't set the point:
'Server.SetOPCValue "SCX:////CAdvOPCDigital/RRC WWTP.Process Screens.Overview.Lift Station 1.I/O.SCADA Timer Mode.CurrentValue", 1'
If I remove the apostrophes:
'Server.SetOPCValue "' + "Parameter:A On CMD Tag.ObjectLink" + '.CurrentValue' + '", 1'
I get this with a "The item name is no longer available in the server" error:
Server.SetOPCValue "SCX:////CAdvOPCDigital/RRC WWTP.Process Screens.Overview.Lift Station 1.I/O.SCADA Timer Mode.CurrentValue", 1_**


You shouldn't be passing the ObjectLink format into the Server.SetOPCValue.
If you look at the help for Server.SetOPCValue it wants the Tagname

sDesc = InputBox ("Enter the New High High Desc")
Server.SetOPCValue ".AI1.HighHighDesc", sDesc

Try ''Server.SetOPCValue "'' + "Parameter:A On CMD Tag.FullName" + '.CurrentValue", 1'

What you want is something that eventually looks like
Server.SetOPCValue "RRC WWTP.Process Screens.Overview.Lift Station 1.I/O.SCADA Timer Mode.CurrentValue", 1

I also think that you need to reconsider your SCADA hierarchy layout. That tagname is really quite horrible.
Why have 'Process Screens', or 'Overview' in there, or 'I/O' in there?
And 'SCADA Timer Mode' sounds suspiciously like you intend on using SCADA to perform some kind of timer functionality, which is not a good way to engineer a control system.

If 'Process Screens' is indeed an area of the 'RRC WWTP', then it makes sense.. but if you mean that this group will hold Mimics (/Screens) which contain process information, then I think you should reconsider this...


Ok, you don't like me, I get it. 🙂
I did look at the help. ClearSCADA is just not intuitive to me and this is not the only issue I'm trying to solve and it should not be this hard to set a bit within a symbol or to link one once you have it setup. As I said, I had a working Server.SetOPCValue linked button, just not in a symbol with parameters. I know I'm trying to get the .CurrentValue path or that is what I thought based on the link that was working. I'm just happy to have a few other symbols with parameters working at all.
I most likely shouldn't be spending time on symbols anyway, they are just about as hard to link in ClearSCADA as just doing each one manually but I've never used ClearSCADA before and wanted to try and do best practice-ish.
Yes, ClearSCADA tags are awful you are right but I'm trying to makes sense of the project without just putting everything in one folder and it was partly input from another engineer that has done 4 CleadSCADA applications. The down side of being OCD and ClearSCADA not having a real database.
"SCADA Timer Mode' sounds suspiciously like you intend on using SCADA to perform some kind of timer functionality"
No worries I'd never let ClearSCADA or any SCADA package handle anything like that but especially ClearSCADA. Don't want to overtax it. 🙂
That worked! The full name plus the .CurrentValue was all that was needed. I just needed to think on it a bit more as it makes sense now.
Sorry if I sound like the grumpy old man that I now am but my original reply was going to be: "Your face is really quite horrible' and so is NotSoClearSCADA.
P.S. If your symbol needs two or more tags then your dragin' all those tags each time you want to use it right? No way to group drag? No way to darg a tag onto more than on symbol at a time?_**


You can group tags but they have to be in a group folder together and the points names set to a specific name. Then the parameters have to be laid out in the same hierarchy using those names.
You drag the folder to the embedded mimic and select the Configure All Option.

(Hum this brings to mind are you making your parameters in a group such as Tag and then CurrentValue, etc placed in it?
Then when you drag a point to the embedded mimic and select "Tag Configure All" it will set all the parameters to that Tag.)

I did this grouped tags thing with points like currents and voltages and their angles once but I did not like that the point name was generic and the group folder was the unique name.
For example I ended up with Ia.Value and Ia.Angle instead of just Ia and Ia Angle. Since then I have used it but only where it did not cause an annoying name reference.

I don't know if this would be a helpful, to your design, applied to your project.
I try to build group templates so a lot of my references are short because they are limited to the folder hierarchy of the template. From the template instance I embed graphics on to my main mimics. some of my embedded mimics have buttons that call popup mimics, that are in the template instance, that have more details.
Editing the template updates all the instances, except where I have overrides set. Usually my overrides are limited to the outstation and some scaling. sometimes the point address. I almost never set an override on a mimic. this means if I edit parameters in a graphic I only have to update the references in the template.

Throughout the whole system I mostly use relative point references so things nested down in group folders is not really a problem, and the references still tend to be short.

I typically have quite some depth to my group folders. The only place I find it problematic is the default alarm source is the object's full name. I usually write a script that takes the parent group folder name that the template instance is in, the template instance name, and the point or object name. Then I use to that to set the alarm source. I use it when I create a template instance and it runs through all the points/objects in it and sets their Alarm source.


I've used a large number of SCADA platforms, and ClearSCADA is the best that is currently available in my opinion.

Symbols will tend to represent a device. A device will tend to be represented by a group of points / objects, and so if you have a symbol that you drag onto a mimic for a device, then you will typically only drag on the folder for that matching device instance also.
Hence one drag and drop.

Commonly what will happen is that the template for a device will be built to have a symbol
within it already pre-populated. Then you can just drag and drop on the symbol from within the template instance.

ClearSCADA is generally about working smarter. You need to try to think in an object / hierarchy approach.
So you will generally have a number of 'pump' objects, you should try to have standardisation, so as few variants as possible from the field, through the PLC / RTU, and into SCADA. So maybe you have four or so pump Templates (FWD DOL, FWD/REV DOL, Soft Starter, VSD).. you then instantiate one of these per pump you have in the field.
But these pumps will be located somewhere, perhaps in a wet well, perhaps in some area of a plant, or associated with some process... If you have a number of wet wells in your system then you should be trying to standardise again.. do you have some with just floats, others with hydrostatic/ultrasonic levels.. then you can instantiate one of these, and have the pumps inside it... just like in the real world.
This then allows you to have your animations all pre-configured.. the pump template instances should have pump graphics, wet well template instances should look like wet wells..
Drag onto the mimic and you're done. Heck, you probably make the sites similar since you have a few of these wet well / pump combos, so you make a template which contains the template instances.. then you can just stamp out an entirely new site just by instantiating one new template.

I can't think of many other SCADA systems that would handle this so gracefully. Certainly not WinCC, nor FactoryTalk View SE, nor Citect, nor iFix..


I'm the same, 26+ years and used Lookout, Wonderware InTouch, Wonderware System Platform, Cimplicity, Fix 32, iFix (now with Enhanced Coordinates System and stuff), RS View 32? (the old one), RS View SE, RS View ME (and other HMIs), that HSQ one, USData Factory Link and so on. Some only a few times long ago and master of none. 🙂
Of modern platforms I use most, RS View SE and iFix were at the bottom of but that honor now goes to ClearSCADA. My opinion could change after the project is done but man, what a pain to do just basic stuff. I'm converting this application for an existing Citect one and it looks easier to use.
"ClearSCADA is generally about working smarter." There is no other option. I totally get what you are saying about templates and symbols but you have to decide if putting the time into all the different ones you will need is worth it. As far as I can tell you are almost forced to make symbols or templates so you can reuse anything as there is no search and replace. There isn't right?! I've wasted so much time if there is, so much time.
Without asking anything the phone support guy even apologized regarding the graphic development in ClearSCADA and said they are working on making it easier to use and that it's still really great because its server and not client based. Okay.
I've already got a few more of these than I'd like from support:
Hi #####,
Yes, you are right, CS does not have those features.
Another engineer in the office has done 4 ClearSCADA applications and says he likes it a lot but another guy did the screens for him. I've shown him a number of things and he just sets there for a moment and then says, yah. He said he likes how you can just rename and copy stuff in database but I find that I'm always worrying if something was or should be Relative and if it will work when copied and being sure to close and save everything when I rename something and or add something to a symbol and then have to relink or re-embed.
All packages have their issues and I'm sure ClearSCADA is great if you've used it a bunch and do lots of systems for the same kind of customer with 100 identical well sites or something but so far it's not for me. This morning I was trying to copy a folder with a set of On/Off buttons in it to make yet another set and pasted it into the same folder by mistake, I then proceeded to delete the wrong folder and all gone. Had to recreate the buttons again. I've just spent the last hour sizing a couple of popup screens and now I need to figure out why my single button with a single Hyperlink Pick Action is opening the popup twice. Also, trends are umm, not so great and I'd kill for a regular tag database with CSV import export._**



Hi! I'm using ClearSCADA for 6 years. Previous hmi was Citect.

Working with database in ViewX is hard, so I made special Excel add-in and use it for almost all configurations. Check my thread http://telemetry.schneider-electric.com/id3/forum/messageview.cfm?catid=74&threadid=2603&enterthread...

Also i made some video presentations https://www.youtube.com/playlist?list=PLIy29wWxQPvgtpobJCFbyHWE69yxLTmkr

I have systems with more than 15000 license points. All my analog and discrete points are located in instances of templates.


The Bulk Edit Tool might help with the large changes to the database properties (like if you get a points units wrong, or if you need to edit lots of ZeroScale/FullScale ranges).
For these things I tend to just use QueryPad and write a little SQL to update them.
It's an incredibly powerful tool... a little dangerous too of course, with great power comes great something... I forget right now 😉

A 'regular tag database' makes no real sense with a hierarchical database.
If you just want to deal with things in a more flat structure, then learn about QueryPad. Everything in ClearSCADA is a table, so you can update the entries in these tables all you want..
gives you the complete list of points in your ClearSCADA database ('just like' the variable.dbf in Citect)
But you can also do UPDATE CDBPoint SET ParentId=0
And then like magic you have an entirely flat point database... which is horrible and not recommended.

I really don't get what you mean about having a folder with a set of On/Off buttons... do you mean you have a whole bunch of mimics within a group? I think this is the issue, you're constantly trying to use ClearSCADA as if it was a different software package. Your current complaints about ClearSCADA would be like if I opened up Microsoft Publisher and started complaining about how none of my formulas were working like how they work in Excel. They're different software packages, you need to learn to use the software package in the right way.

I assume you haven't taken a ClearSCADA training course from Schneider or a Master / Platinum Schneider Partner. I would really recommend that you invest in such a training course. Learning how to use the tool is important in getting work done quickly, correctly and without significant rework.


That don't sound like any database I've used. Training classes can be helpful but they aren't going to fix all ClearSCADAs ills or add the missing features that support and this forum say are unavailable. I've watched the training videos they have and talked to support and I'd hope support has had some training and more experience than I have. I get it, you like ClearSCADA and I don't so I'm dumb and untrained. I'm trying to use iFix VBA code and can't figure out why it's not working in ClearSCADA. Your supper smart or been using it a lot. Bulk edit tools and QueryPads and Server.SetOPCValue don't use that use a method but I need to write more than one bit and so on. I can't use symbols in a group? What was I thinking? Now I have to deal with the horrors that is ClearSCADA OPC._**


I just don't think you've even tried to understand how to use ClearSCADA. It's like you're trying to use a screwdriver as a spanner and complaining that it doesn't work well.
So of course when you ask support "How do I remove this nut with ClearSCADA?" they will reply back with "ClearSCADA doesn't do that"..

What do you mean by "I can't use symbols in a group"?
There is no true ClearSCADA object called a 'symbol', so of course you can't use symbols. They don't really exist in ClearSCADA. Perhaps what you're thinking of is an Embedded Mimic.
And do you mean a Group (like a database folder), or just graphically grouping things (like on a mimic)?
If you mean a folder, then no you can't Embed a Mimic in a Group. But you can certainly have Mimics located as Children to a Group.
Or you could graphically group Embedded Mimics on another Mimic.

The reason that iFix VBA code won't work in ClearSCADA is that ClearSCADA does not support VBA. ClearSCADA provides access to two scripting runtimes, VBScript (which is not VBA), and JavaScript (which is also not VBA).

What is it that makes you say ClearSCADA OPC is a 'horror'? Have you used any other OPC tools before? If you've used Kepware or Matrikon OPC Servers then ClearSCADA's OPC should be quite familiar to you. That ClearSCADA ships with an OPC tunneler as part of the Data Access Components, and you can avoid DCOM thanks to this then it's much nicer than most other OPC servers.


Thanks for the help but I disagree. "It's like you're trying'" No, it is not like that. Not at all like that to me. Just one guys opinion, you and ClearSCADA will live.
Now I'm not trying. 😞 I have tried and I understand more each day I work with it but' no key scripts and right click scripts or up vs down click script and so-so trending (can't add pens or create pen groups) and the alarm summary descriptions thing and no search and replace and can't hide the title bar and writing to point or two points with one click and getting the date-hours-minutes-seconds and using popups is odd/hard and seeing animated objects in development and no of rotating symbols and no bar graph animation and the hide desktop function check box thing that don't work the way it's documented and looks like you can't make many types of changes to symbols with out having to replace them all and or relink them wherever they may be and text moving around just a bit in symbols templates on the same screen and move more in ViewX on different systems and more (but my memory is bad and things like no Ctrl+D and random Esc and Ctrl+A functionality are admitted petty but they still mess with me) are not random "nuts" to me.
Again, if your supper smart and been using it a long time and or only and your projects are repetitive and rigid, I'm sure it's great. But if you just want through a button or other object on the screen and link it up and then quickly use it on another screen with different set of a number of tags it "is really quite horrible." Even if you take the time to set up templates changing points/tags is still "is really quite horrible."
Thanks for the helping parts, good day to you Sir. 🙂
Back to buttons, should someone happen upon this looking for button info.
Not wanting the GUI method popup asking for values in runtime when clicking the Button symbol, I found you can use the PickParam animation to set a specific value.
For these to work I needed a Parameters group with the FullName and or ObjectLink parameters inside it.
I started out with the 'Server.SetOPCValue script option working thanks to Bevan Weiss.
PickParam: ''Server.SetOPCValue "'' + "Parameter:A On CMD Tag.FullName" + '.CurrentValue", 1'
PickType: 20
Support saw this and said I should be using a method as the "Server." commands create an extra connection to the server outside of ViewX. So it ended up like this.
PickParam: "Parameter: A On CMD Tag.ObjectLink" + '?Control&Value="1"'
PickType: 5
But then I found out that I needed to set two values with one of the buttons. Its too bad you can't just add a second line in the PickParam.
The manual has some info shown below but you are still using a "Server." command and I was told this is the way to go if you are changing many properties at once. It takes longer to use the FindObject or something. I also could not figure out how to pass the script function the correct Parameter info.
Was given the Sub CodeButton example below but was also told I could just go back to the ''Server.SetOPCValue" script as I'd be making a server connection anyway and could then write two or more values at once. Removing the PickParam and PickType animations and just using the Pick Action Configuration Wizard, select script, Execute Code Fragment.
This worked but only after many attempts and removing the spaces from Parameter name and then I also had to give the Everyone group access to the database. 😞 Not sure what we will do now.
Turns out this was a bug and was fixed in/with the August 2017 update. It was letting you login with any combination of upper and lower case letters for the User Name as it should but was then rejecting the already logged on user in scripting when the User Name did not match the case used to create the account. So in Users, if the account was named "Admin" and you logged in as "admin" you'd get into ViewX but somethings that then required an account check would fail._**

Code Fragment

_Server.SetOPCValue Mimic.Parameters.A_Duty_CMD_And_Status_Tag.FullName, 1
Server.SetOPCValue Mimic.Parameters.A_Standby_CMD_And_Status_Tag.FullName, 2_

_Sub CodeButton
Set p1 = Mimic.Parameters
Set p2 = Mimic.Parameters
Set obj1 = Server.FindObject (p1.FullName)
Set obj2 = Server.FindObject (p2.FullName)
'Controlling 2 parameters to 88
obj1.Interface.Control 88
obj2.Interface.Control 88
End Sub_

**Using a Script to Issue Two Controls from One Pick Action**

You can use a script to allow a single pick action to issue two controls. This is useful when multiple responses are required to a specific occurrence.


In the following example, a script is used to allow a point override control and an acknowledge alarm control to be performed when a Mimic item is selected. When a user selects the Mimic item (in this case, a water tank), an alarm is acknowledged for a point named 'Water Control', and the same point is overridden to have its value set to 50. The script for the two controls is:

_Public Function TankEmergency (sTankControl)
Dim oTankPoint
Set oTankPoint = Server.FindObject(sTankControl)
If Not (oTankPoint Is Nothing) Then
oTankPoint.Interface.AcceptWithComment "Alarm Acknowledged via Mimic"
oTankPoint.Interface.Override 50
Set oTankPoint = Nothing
End If
End Function_