Moldflow Insight Forum
Welcome to Autodesk’s Moldflow Insight Forums. Share your knowledge, ask questions, and explore popular Moldflow Insight topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use a script to turn off Moldflow synergy

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
1292909313
154 Views, 3 Replies

How to use a script to turn off Moldflow synergy

How to use a script to turn off Moldflow synergy

3 REPLIES 3
Message 2 of 4
bernor_mf
in reply to: 1292909313

@1292909313 

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

( If my comments are accepted, provide "Kudos" as appreciation. If your request is answered/resolved, please click the "Accept as Solution" button. Thanks.)
Message 3 of 4
1292909313
in reply to: 1292909313

'%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

 

Message 4 of 4
bernor_mf
in reply to: 1292909313

@1292909313 

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

( If my comments are accepted, provide "Kudos" as appreciation. If your request is answered/resolved, please click the "Accept as Solution" button. Thanks.)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report