Listing POUs in Project with Scripts

magicman
2022-10-07
2022-10-10
  • magicman - 2022-10-07

    Trying to use scripts to scan the POUs in a folder in the object tree in order to use the names of the POUs in another location, just as a way to automate some programming tasks. Problem I'm running into is I can't find the right attribute to call to flag an object in the tree as a POU. I've tried the closest thing I could find which is .is_fb but it returns with an error saying it's not an attribute of ScriptObject. Any help pointing me in the right direction would be greatly appreciated.

     
  • paulpotat

    paulpotat - 2022-10-10

    Hello,
    You can check the export.py file of this github repo, it generates text files for every POU in a project (and more).
    To do so, it iterates over every object in a project recursively, starting with the tree returned by projects.primary.get_children().

    I hope this can help you,
    BR

     

Log in to post a comment.