Creating a script for a specific instance of Synergy
You can create or edit a script to call the specific instance of Synergy you are working with on your machine.
Each instance of Synergy is assigned an instance ID, which can be found in the About box. The instance ID is different for every synergy opened and you can use it to ensure that the correct instance of Synergy has been called. You can set the SAInstance
environment variable to the instance ID of the Synergy that you want your script invoke.
The first line of a Python or PowerShell script or macro, designed to call the specific instance of Synergy, must be:
# %RunPerInstance
Here are some steps on how to use a python script for a specific instance of Synergy.
Type the line before this as your first line.
Type explanatory comments to explain the code.
Type
from moldflow import Synergy() synergy = Synergy()
to create a Synergy class object which starts the specific instance Synergy that you are working in.
Continue with your scripting.
An example of how the full file looks like:
# %RunPerInstance
"""
DESCRIPTION:
Example script to get started on Moldflow API.
This script is used to open the most recent project and study
USAGE:
filename.py
"""
from moldflow import Synergy
synergy = Synergy()
synergy.open_recent_project(0)
project = synergy.project
project.open_item_by_index(1)