Factorytalk SE - Execute a Macro when display is opened.

sanger

Member
Join Date
Nov 2005
Location
Toronto
Posts
172
Is there a way to create a Macro that is executed when a display is opened. I know how to create a Display_AnimationStart() routine to execute some VBA code but it seems like a Macro would be a bit simpler in this particular situation since we just need to set the values of a number of PLC tags.

If VBA code is the only way to do this what is the VBA syntax for writing a value to a PLC tag (where the tag has not been pre-defined in the SE Tags database.
 
Writing to tags with VBA can be done, but a simpler approach might be to write the macro, and then use VBA to run the macro at animation start?
 
Wait a minute...you got me thinking about VBA and I forgot about the obvious way to do it. Right click on your display, click Display Settings, click the Behaviour tab, and put your macro in the startup commands. When you create a macro, it gets added to the list of commands automatically.
 
The macros also support complete expressions if you require something more than just writing a value. Alternatively, you can toggle a bit with the macro that executes more complex code in the PLC.

1) In the project tree, scroll down to Macros and add a new one.
2) On the left, put your PLC tag in "Tag", for example {[PLCTarget]YourTag}.
3) On the right, put your value, expression or other tag in "Expression".
4) As per ADF's comments. Open your display, right click and chose "Display Settings".
5) Click the "Behaviour" Tab.
6) Chose your "Startup" or "Shutdown" Macro for that screen.
7) Drink beer and celebrate**.

Make sure the value you write and the tag data type match, otherwise you can open up a hole in the space-time continuum.

**This step is not mandatory, but recommended for improved results.
 
Last edited:
Generalising it

If you wish to generalise the code, you can also use the Parameter File apart from just passing the value to a tag using the marco. Although it works, but in the long run if you have to shuffle things around it might be better using Parameter file.

Just my thoughts 🍻
 
7) Drink beer and celebrate**.

Make sure the value you write and the tag data type match, otherwise you can open up a hole in the space-time continuum.

**This step is not mandatory, but recommended for improved results.

I think I would have known you're an Aussie even without the flag to tell me ;)
 
I think I would have known you're an Aussie even without the flag to tell me ;)

It's funny, because I've worked with commissioning guys from all parts of the world, and 7) seems to be internationally recognised.
 

Similar Topics

Hi, I've got a project where I have to execute a VBA code cyclically - let's say every 1 minute. I've created a 'hidden' display which is opened...
Replies
2
Views
8,834
how to communicate FactoryTalk Optix and Mitsubishi Q Series. I want to know the details of that
Replies
0
Views
22
Hoping someone can give me some guidance or confirmation of what I need to do. We have a FactoryTalk SE program that I need to change the IP...
Replies
0
Views
28
We are a water/wastewater plant, collecting realtime and manually entered data. We have been using FactoryTalk Historian (OSI PI) for real time...
Replies
1
Views
58
Good morning! Let me start by saying, I am still learning about this type of HMI programming. I recently watched a video about recipes and how it...
Replies
0
Views
53
Back
Top Bottom