ÄÚµù ¹®¿ÜÇÑ ÀÔ´Ï´Ù....VBSÆÄÀÏÀ» ¿¢¼¿¿¡¼ ¸ÅÅ©·Î·Î ±¸µ¿ °¡´ÉÇÏ°Ô ¹Ù²Ù´Â ÁßÀε¥ ÀüÇô¸ð¸£°Ú½À´Ï´Ù
160;1649;업1060; 프/196;그래머가 아니라 해NJ17; 1648;식1060; 1204;무한 상황1077;니다
사용1473;1064; SW 1032; API 기능1012; 활용해 보고1088; 1068;단 SW 에 1080;lj16; 예1228; 파1068;1012; VBS 파1068;/196; 만들Ǻ12;서 1089;ᇼ1; 시켜보니 1096; .121;니다
1060;1228; 1060; 파1068;1012; Ꮘ1;셀 메크/196;/196; 만들Ǻ12;서 써보/140;lj16;데 NJ17;연7176;?? 1089;ᇼ1;1060; 안.121;니다....
앞서서 간단한 예1228;들1008; Ꮘ1;셀/196; 변환시켜 1089;ᇼ1; 시켜봤lj16;데 1060;번,144;lj16; 길Ǻ12;서 1096; 모르lj16;,144;도 1080;고160;
Ꮘ1;셀에서 디버그/196; 올라오lj16;,144; 보면 1200;,172; 왜 문1228;1064;1648;도 1096; 모르,192;고 Ȣ16;lj16; 상황1077;니다
아래lj16; VBS 파1068;1032; 내용1077;니다
Option Explicit
SetLocale("en-us")
Dim Synergy
Dim SynergyGetter
On Error Resume Next
Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
On Error GoTo 0
If (Not IsEmpty(SynergyGetter)) Then
160; 160;160;Set Synergy = SynergyGetter.GetSASynergy
Else
160; 160;160;Set Synergy = CreateObject("Synergy.Synergy")
End If
Dim StudyDoc
Set StudyDoc = Synergy.StudyDoc()
' Get the name of the .out file associated with the flow results.
' NOTE: This assumes a Flow analysis sequence was run.
Dim lName160;
lName = StudyDoc.GetResultPrefix("Flow")
Dim lOutName
lOutName = lName & ".out"160;
' Create and Populate the ScreenOutput Class for the lOutName
Dim lMessages
Set lMessages = New ScreenOutput
lMessages.LoadOutputFile(lOutName)
Dim MM, lStr
' Find the Total Projected Area
' return the array of numerical values associated with the first instance of Message ID (MSCD) 39410
' MSCD 39410 1 0 0 0 0 0 5
' 160; 160; 160; Total projected area 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; = %11.4G
' 160; 160;m^2,1,1
' Note: Please see .../data/dat/shared/cmmesage.dat for format details
Set MM = lMessages.GetMessage(39410,1)
lStr = " Total Proejcted Area 160; 160;= " & CStr(MM.GetFloat(0))160;
MsgBox CStr(lStr)
' Read Maximum Injection pressure and the time it occurred
' return the array of numerical values associated with the last instance of Message ID (MSCD) 39410
' MSCD 41400 1 0 0 0 0 0 5
' 160; 160; 160; Maximum injection pressure 160; 160; 160; 160; 160;(at %11.4G) = %11.4G
' 160; 160;s,1,2
' 160; 160;Pa,1,1
' Note: Please see .../data/dat/shared/cmmesage.dat for format details
Set MM = lMessages.GetMessage(41400,0)
lStr = "Maximum injection pressure occured at " & CStr(MM.GetFloat(1)) & " Pressure = 160; 160; " & CStr(MM.GetFloat(0))160;
MsgBox CStr(lStr)
MsgBox "Script Complete"
' ---- Message class
Class Message
160; Private mMSCD160; 160; 160; 160; 160; 160;160;' MSCD Message ID
160; Private mNumString 160; 160;' Number of Strings associated with the Message
160; Private mNumFloat 160; 160; ' Number of Floats 160;Associated with the Message
160; Private mStrings() 160; 160;' The Strings Associated with the Message
160; Private mFloats()160; 160; 160; 160;160;' The Numerical Values Associated with the Message
160;160;
160; Public Sub SetMSCD(aMSCD)
160; 160; mMSCD = aMSCD
160; End Sub
160;160;
160; Public Sub SetNumString(aNumString)
160; 160; mNumString = aNumString
160; End Sub
160;160;
160; Public Sub SetNumFloat(aNumFloat)
160; 160; mNumFloat = aNumFloat
160; End Sub
160;160;
160; Public Sub AddFloat(aFloat)
160; 160; mNumFloat = mNumFloat + 1
160; 160; ReDim Preserve mFloats(mNumFloat)
160; 160; mFloats(mNumFloat-1) = aFloat
160; End Sub
160;160;
160; Public Sub AddString(aString)
160; 160; mNumString = mNumString + 1
160; 160; ReDim Preserve mStrings(mNumString)
160; 160; mStrings(mNumString-1) = aString
160; End Sub
160;160;
160; Public Function GetMSCD()
160; 160; 160;160;GetMSCD = mMSCD
160; End Function
160; Public Function GetString(aIndex)
160; 160; GetString = ""
160; 160; 160;160;If aIndex >= 0 And aIndex < mNumString Then
160; 160; 160;160;160; 160;GetString = mStrings(aIndex)
160; 160; 160;160;End if
160; End Function
160;160;
160; Public Function GetFloat(aIndex)
160; 160; GetFloat = ""
160; 160; 160;160;If aIndex >= 0 And aIndex < mNumFloat Then
160; 160; 160;160;160; 160;GetFloat = mFloats(aIndex)
160; 160; 160;160;End if
160; End Function
160;160;
160; Public Function GetNumString()
160; 160; GetNumString = mNumString
160; End Function
160;160;
160; Public Function GetNumFloat()
160; 160; GetNumFloat = mNumFloat
160; End Function
160;160;
160; Private Sub Class_Initialize
160; 160; mMSCD = -1
160; 160; mNumString = 0
160; 160; mNumFloat = 0
160; End Sub
End Class
Class ScreenOutput
160;Private mMessages()160; 160; 160; 160;160;' Array of Messages associate with the screen output File
160;Private mNumMessages160; 160; 160; 160;160;' Number of messages in the screen output file
160; Public Function LoadOutputFile(aFile)
160; 160; 160;160;Const ForReading = 1
160; 160; 160;160;Dim FS
160; 160; 160;160;Set FS = CreateObject("Scripting.FileSystemObject")
160; 160; 160;160;Dim File
160; 160; Set File = FS.OpenTextFile(aFile, ForReading)
160; 160; 160; 160; While Not File.AtEndOfStream
160; 160; 160; 160;160;Dim ID
160; 160; 160; 160;160;ID = -1
160; 160; 160; 160;160; 160;160;' Read the MSCD
160; 160; 160; 160;160; 160;160;Dim Line,lenLine
160; 160; 160; 160;160;Line = File.ReadLine
160; 160; 160; 160;160;lenLine = len(Line)
160; 160; 160; 160;160;If Not File.AtEndOfStream or lenLine >= 1 Then
160; 160; 160; 160; 160; 160;160;ID = Line
160; 160; 160; 160; 160; 160;160;Dim curMessage
160; 160; 160; 160; 160; 160;160;Set curMessage = New Message
160; 160; 160; 160; 160; 160;160;curMessage.SetMSCD(ID)
160; 160; 160; 160; 160; 160;160;' Read the number of strings
160; 160; 160; 160; 160; 160;160;Line = File.ReadLine
160; 160; 160; 160; 160; 160;160;lenLine = len(Line)
160; 160; 160; 160; 160; 160;160;If Not File.AtEndOfStream or lenLine >= 1 Then
160; 160; 160; 160; 160; 160; 160; 160;160;Dim numString
160; 160; 160; 160; 160; 160; 160; 160;160;numString = Line
160; 160; 160; 160; 160; 160; 160; 160;160;' Read Strings
160; 160; 160; 160; 160; 160; 160; 160;160;Dim i
160; 160; 160; 160; 160; 160; 160; 160;160;For i = 1 To numString
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;Line = File.ReadLine
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;lenLine = len(Line)
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;If Not File.AtEndOfStream or lenLine >= 1 Then
160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;CurMessage.AddString(Line)
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;End if
160; 160; 160; 160; 160; 160; 160; 160;160;Next
160; 160; 160; 160; 160; 160;160;End if
160; 160; 160; 160; 160; 160;160;' Read the number of floats
160; 160; 160; 160; 160; 160;160;Line = File.ReadLine
160; 160; 160; 160; 160; 160;160;lenLine = len(Line)
160; 160; 160; 160; 160; 160;160;If Not File.AtEndOfStream or lenLine >= 1 Then
160; 160; 160; 160; 160; 160; 160; 160;160;Dim numFloat
160; 160; 160; 160; 160; 160; 160; 160;160;numFloat = Line
160; 160; 160; 160; 160; 160; 160; 160;160;' Read Floats
160; 160; 160; 160; 160; 160; 160; 160;160;For i = 1 To numFloat
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;Line = File.ReadLine
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;lenLine = len(Line)
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;If Not File.AtEndOfStream or lenLine >= 1 Then
160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;CurMessage.AddFloat(Line)
160; 160; 160; 160; 160; 160; 160; 160; 160; 160;160;End if
160; 160; 160; 160; 160; 160; 160; 160;160;Next
160; 160; 160; 160; 160; 160;160;End If
160; 160; 160; 160; 160; 160;160;' Add current message to the list
160; 160; 160; 160; 160; 160;160;AddMessage(CurMessage)
160; 160; 160; 160;160;End If
160; 160;160;Wend
160; 160; File.Close
160; End Function
160;160;
160; Public Sub AddMessage(aMessage)
160; 160;160;mNumMessages = mNumMessages + 1
160; 160;160; 160;160;ReDim Preserve mMessages(mNumMessages)
160; 160; Set mMessages(mNumMessages-1) = aMessage
160; End Sub
160;160;
160; Public Function GetNumMessages()
160; 160; GetNumMessages = mNumMessages
160; End Function
160;160;
160; Public Function GetMessage(aMSCD,aOccur)
160; 160; 160;160;Set GetMessage = Nothing
160; 160; 160;160;Dim j
160; 160; 160;160;Dim lFindInstance
160; 160; 160;160;lFindInstance = aOccur
160; 160; 160;160;If aOccur < 0 Then
160; 160; 160; 160; 160;160;lFindInstance = 0
160; 160; 160;160;End if
160; 160; 160;160;Dim Count
160; 160; 160;160;Count = 0
160; 160; 160;160;For j = 0 To mNumMessages-1
160; 160; 160; 160; 160;160;'MsgBox mMessages(j).GetMSCD &"|"& aMSCD
160; 160; 160; 160; 160;160;If CStr(mMessages(j).GetMSCD) = CStr(aMSCD) Then
160; 160; 160; 160; 160;160;160; 160;Count = Count + 1
160; 160; 160; 160; 160;160;160; 160;If Count >= lFindInstance Then
160; 160; 160; 160; 160;160;160; 160;160; 160; 160; 160;160;Set GetMessage = mMessages(j)
160; 160; 160; 160; 160;160;160; 160;160; 160; 160; 160;160;Exit Function
160; 160; 160; 160; 160;160;160; 160;End if
160; 160; 160; 160; 160;160;End if
160; 160; 160;160;Next
160; End Function
160;160;
160; Private Sub Class_Initialize
160; 160;160;mNumMessages = 0
160; End Sub
End Class
1060;,152; Ꮘ1;셀 메크/196;에 넣Ǻ12;서 첫1460;에 sub 메크/196;명 넣고 1473;간에 Message Class 위에 End Sub 넣고 살행시켜보면
컴파1068; 오류 1077;니다
사용1088; 형식1060; 1648;1221;.104;1648; 않았습니다 160;라고 뜨면서
아래1032; New screenoutput 1012; Ȣ16;1060;라1060;트 시킵니다
Dim lMessages
Set lMessages = New ScreenOutput
lMessages.LoadOutputFile (lOutName)
,160;색상1004;/196;lj16; 무슨 라1060;브러리를 추가해야.108;다고 Ȣ16;면서 설명해1452;lj16; ,163;들1012; 해봤1648;만
신통치가 않았습니다160;
1228;가 프/196;그래머가 아닌1648;라 아1452; 기초1201;1064; 뭔가를 모르고 1080;lj16;,148;1648; ᕬ1;시 윗내용만 보고 알수 1080;lj16;,172; 1080;1012;1648; 1656;문 남깁니다..
160;