Hi guys, is there a list larger than 6 entries for the recently modified templates/windows/views?
Where I work, we aren't using VCS and sometimes I'd like to do quick sanity check searches for recently modified stuff, like when was a specific window last modified and by whom.
If you're using my Ignition Extensions module, this is pretty trivial to do with the system.project.getProject() method:
from com.inductiveautomation.ignition.common.project.resource import ResourceType
from com.inductiveautomation.ignition.common.util import ResourceUtil
def getMostRecent(moduleId, typeId):
project = system.project.getProject()
allResources = [
resource
for resource in project.getResourcesOfType(ResourceType(moduleId, typeId))
if project.isLocal(resource.resourcePath) # note - this filter will only work in the designer
]
allResources.sort(cmp=ResourceUtil.SORT_BY_MOST_RECENT.compare)
return allResources
for resource in getMostRecent("com.inductiveautomation.vision", "windows"):
print resource.folderPath
If you don't/won't/can't use Ignition Extensions, you'll have to obtain a reference to the project in some other way. The two arguments to pass in can be obtained from the filesystem.
1 Like