Rename AF Message

Rename AF Message

I inherited a project written using Actor Framework recently. I started to do a little refactoring to make it easier to add some of the changes I needed to make, following Kent Beck’s idea of “First make the change easy, then make the easy change.”

Tweet from Kent Beck: "For each desired change, make the change easy (warning: this may be hard), then make the easy change."
Some wisdom from Kent Beck

What is in a name?

They say naming is hard and it is. In this case, the names of the messages didn’t quite reflect my understanding of what they did. So I wanted to change the names of these messages, to make things just a little easier to understand.

How hard can it be?

Well, the first question you might have is: “How hard can it be to rename a message?” The answer is surprisingly difficult. One may argue that the AF does some things well, but one of those is certainly not allowing for refactoring. When you say “rename a message”, it sounds like one atomic action. The reality is quite different.

The name of a message in AF actually shows up in several places.

  1. The name of method on the Actor, which is called by the Message Class Do VI
  2. The name of the Message Class itself
  3. The folder the Message Class is in
  4. The name of the Send VI
  5. The label of the class controls in the Do VI

This is of course assuming that one originally created the message using the normal AF message scripting tools that ship with LabVIEW.

LabVIEW project showing and Actor Class with a single message. Everywhere the message name shows up is highlighted.
All the places the message name shows up in the project
An actor Message Folder with an Actor Message in it with the name of the message highlighted.
The message name even shows up in the folder structure.
A Do VI with the name of the message highlighted where it appears in the object label.
It even shows up in the Do VI

For consistency’s sake and to be kind to your future self, you really want to change all of those references at the same time. That’s a lot of clicks and a lot of things to remember. It’s prone to human error. Changing a single message by hand is doable, but in my case, I wanted to change a bunch of messages. I thought there must already be some tool to do this, but I couldn’t find one. Admittedly I didn’t look too hard. I immediately jumped to “I can probably create a tool for that myself.” So I did.

Rename AF Message

I wrote a very simple tool that runs from the Tools Menu. You point it at a Message Class and give it a new name. It takes care of the rest. It renames the message class and moves everything into a renamed folder. It cleans up the names of the class controls and indicators. It renames the send VI and optionally renames the Actor method associated with the message.

So instead of remembering a bunch of steps and executing dozens of clicks, it’s reduced down to 4 actions.

  • Launch the tool
  • Select the Message Class to Rename
  • Provide the New Name
  • Click OK
A LabVIEW project. Shows a tool menu open with SAS>Class Refactoring>Rname Af MEssage ... highlighted.
Here’s how you access the tool once you install the VIPM package.
A simple GUI dialog where one can select a message to be renamed (via a path control) and enter a new name via a string control. There is a checkbox to rename the Actor Method as well. At the bottom there is an Ok and Cancel button.
Here’s the initial GUI. Yes, it’s rough but remember this was just a proof of concept. I haven’t had time to polish it much yet. By the time you are reading this, it will hopefully be improved, unless I get distracted by more important things like paid work.


Works on direct messages, not abstract messages. Not tested with interfaces (yet), but in theory, I think it should work. It assumes that the message was created by the AF Message Maker Tool and that you didn’t go around messing with the message afterward, liking renaming things or moving them around on disk.

The code does need some cleaning up. At first, I just wrote the most rudimentary scripting just to do a proof of concept and knock out what I needed for this project. The idea of distributing it came a little later. I’ve started to clean it up a little, but it could definitely use a little refactoring.

Written in LV2020, although it is open source and doesn’t use anything 2020 specific, so you could totally clone the repo and back save it.

Future Improvements

I’m probably going to upgrade the GUI in the future so that instead of selecting the Message Class by path, you’ll get some sort of dropdown or listbox listing all the message classes in the project. It could also use a little polishing in terms of aesthetics. It might also be good to remember the Selection for updating the Actor Name from one call to the next.

Try it out

Get the latest release here:

GitLab Release Page showing that the vip file can be found under Other.
Once you are on the release page, find the most recent release and find the vip file under other. Click on it to download the vip and then install via VIPM. As of right now, I haven’t posted it to so it won’t just show up in VIPM. I might do that at some point.


If you need help untangling legacy AF projects, we can help. Use the button below to schedule a call.