- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Modelers,
I am trying to learn API. I wrote a visual basic script with creates multiple study files from a study file named 'sample.sdy' by changing injection time values. I also have command to start the analysis added in the script. I have written the script in the post for reference.
The problem is when i run the script, the multiple study files are created but all of them are simulated with same injection time, and not the injection time i set using the script. Mostly they take the injection time value of the last study file created (Refer the script : Injection time = 4s, from xyz.sdy is taken by all the studies (abc.sdy and lmn.sdy) here). Please help me with this thing because i have no idea what is going on here. Is this a bug or i am implementing incorrectly?
Regards,
Arjav
<----------------------------Test.vbs------------------------------------>
'%RunPerInstance
'@ DESCRIPTION
'@ Macro recorded by Synergy on 24-Apr-2018 at 15:17:56
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.OpenProject "E:\Scripting_trials\Scripting_trials.mpi"
Synergy.SetUnits "English"
Set Project = Synergy.Project()
Project.OpenItemByName "sample", "Study"
Set StudyDoc = Synergy.StudyDoc()
StudyDoc.SaveAs "abc"
Set PropEd = Synergy.PropertyEditor()
Set Prop = PropEd.FindProperty(30011, 1)
Set DVec = Synergy.CreateDoubleArray()
DVec.AddDouble 2
Prop.FieldValues 10100, DVec
PropEd.CommitChanges "Process Conditions"
Set StudyDoc = Synergy.StudyDoc()
StudyDoc.AnalyzeNow True, True
WScript.Sleep 10000
Set StudyDoc = Synergy.StudyDoc()
StudyDoc.SaveAs "lmn"
Set PropEd = Synergy.PropertyEditor()
Set Prop = PropEd.FindProperty(30011, 1)
Set DVec = Synergy.CreateDoubleArray()
DVec.AddDouble 3
Prop.FieldValues 10100, DVec
PropEd.CommitChanges "Process Conditions"
Set StudyDoc = Synergy.StudyDoc()
StudyDoc.AnalyzeNow True, True
WScript.Sleep 10000
Set StudyDoc = Synergy.StudyDoc()
StudyDoc.SaveAs "xyz"
Set PropEd = Synergy.PropertyEditor()
Set Prop = PropEd.FindProperty(30011, 1)
Set DVec = Synergy.CreateDoubleArray()
DVec.AddDouble 4
Prop.FieldValues 10100, DVec
PropEd.CommitChanges "Process Conditions"
Set StudyDoc = Synergy.StudyDoc()
StudyDoc.AnalyzeNow True, True
Solved! Go to Solution.