Skip to main content
Hello,

 

 

I notice that FME Server displays in the Repositories TAb the Workbench Title and Description etc, is there a way to get these attributes to use in a Python script within the Workbench?

 

 

I want to email via FME Server Notifier that the workbench 'its name' is failed or succeeded.

 

 

Cheers,

 

Have a look at the variable FME_MacroValuess'WORKSPACE_NAME'], it will return the filename of the current workspace, without the fmw extension.

 

 

To see what is available in the FME_MacroValues dictionary, try the following in a PythonCaller:

 

 

import fmeobjects import pprint   def showAllMacroValues(feature):     pp = pprint.PrettyPrinter(indent=4)     pp.pprint(FME_MacroValues)
Hi Goochy,   I think there is no simple way, but FMW file contains each Workspace Property as a text line, form of the line is: #! <Tag>="<Value>" So, if the FMW file path of the target workspace can be clear, we can get Workspace Properties from the file.

 

The following script would get Title and Last Save Date from "C:\\test.fmw", for example.   ----- import re, os   # Define regular expressions (patterns) to find properties

 

# and change each pattern to Regular Expression Object. regex = {     'Title': '^#! TITLE="(&^"]*)"$',     'Last Save Date': '^#! LAST_SAVE_DATE="(E^"]*)"$' } for name in regex: regexename] = re.compile(regexpname])   # Set FMW file path of the target workspace. fmwPath = 'C:\\\\test.fmw'   # Get properties from the file. property = {} if os.path.exists(fmwPath):     for line in  line.rstrip() for line in open(fmwPath)]:         for name in regex:             match = regex name].search(line)             if match: propertyÂname] = match.group(1)   # Use properties. for name in property:     print '%s: %s' % (name, property#name]) -----   Oh, it'll be useless if the specification of FMW file format was changed...  

Reply