Scripting function to read the Project Description property

Is there a scripting function that allows reading the Project Description property, as defined under Configure–>System–>Projects–>Edit–>Project Settings–>Description?


Try this:

from com.inductiveautomation.factorypmi.application import FPMIApp
desc = FPMIApp.getInstance().clientContext.project.description

Hi pturmel,

Thanks for your reply.
I tried executing it from the Script Console, but get the following message:

> Traceback (most recent call last):
>   File "<buffer>", line 2, in <module>
> AttributeError: 'com.inductiveautomation.factorypmi.application.FPM' object has no attribute 'clientContext'

After searching, I found the following API 7.8.1 documentation, which states that the getInstance() method has been deprecated.

Any idea where to find the latest API documentation?


Here is the latest SDK JavaDocs:

And here is the answer to your question, but this only works from the client atm.

from com.inductiveautomation.factorypmi.application import FPMIApp
print FPMIApp.getInstance().getClientPanel().getClientContext().getProject().getDescription()

FPMIApp has been deprecated forever.

Actually, there’s a 7.9.4 Javadoc; pretty sure this is the latest release:

Also, you can skip FPMIApp.getInstance() with BasicContainer’s getAppContext(), eg, from a button:

1 Like

Thanks PGriffith, this works for the project’s description:


What about the project’s title?


Doesn’t work…

event.source.parent.getAppContext().getProject().getDisplayTitle() should work in 7.9 - it will either be the project’s title field, or just the name if the title is unspecified.

event.source.parent.getAppContext().getProject().getTitle() or getName() as appropriate should work in 8.0.


Thanks, this works from a button on the window but I cannot get it to work when a window is opened… Im using the following code on a window’s internalFramActivated event handler.

system.gui.getParentWindow(event).getComponentForPath(‘Root Container.projectName’).text = event.source.parent.getAppContext().getProject().getDisplayTitle()
system.gui.getParentWindow(event).getComponentForPath(‘Root Container.projectDescription’).text = event.source.parent.getAppContext().getProject().getDescription()

And am getting this error:

AttributeError: ‘com.inductiveautomation.factorypmi.application.FPM’ object has no attribute ‘getAppContext’

event.source.parent is how you go from a component to its parent, meaning the root container of the window it’s on (assuming you’re not using groups or containers, anyways) - but if you’re running the code and you’re already on a window/root container, then going up to .parent is giving you an object that doesn’t contain the method getAppContext(). Try swapping in event.source.rootContainer.getAppContext().

1 Like

Thanks, learning so much from you today, I really appreciate it!