How to use a script to turn off Moldflow synergy
Solved! Go to Solution.
Solved by bernor_mf. Go to Solution.
Hi,
Just want to have some more input of what you are looking for.
Do you mean to terminate Moldflow Synergy from a script that started Synergy?
Or do you mean to terminate all running Moldflow Synergy from a script?
Regards,
Berndt
'%RunPerInstance
'@ DESCRIPTION
'@ Macro recorded by Synergy on 05-6н┬-2024 at 09:44:33
SetLocale("en-us")
Dim SynergyGetter, Synergy
On Error Resume Next
Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
On Error GoTo 0
If (Not IsEmpty(SynergyGetter)) Then
Set Synergy = SynergyGetter.GetSASynergy
Else
Set Synergy = CreateObject("synergy.Synergy")
End If
Synergy.SetUnits "Metric"
Dim ProjectPath,Project
ProjectPath = "XXX"
Synergy.OpenProject(ProjectPath)
Set Project = Synergy.Project()
Project.OpenItemByIndex 1
Project.ExportModel "XXXX"
I want to close Moldflow after I've done this
Hi,
you could try this.
Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.Run "taskkill /fi ""WINDOWTITLE eq Autodesk Moldflow Insight 2023""",0,False
It looks up the window title and stops Synergy.
Assume only one Synergy is started.
If killed before other tasks in script completed a wait might be needed such as :
WScript.Sleep 10000 ' in milliseconds, so a 10s wait.
Hope this helps.
Regards,
Berndt
Can't find what you're looking for? Ask the community or share your knowledge.