ÄÚµù ¹®¿ÜÇÑ ÀÔ´Ï´Ù....VBSÆÄÀÏÀ» ¿¢¼¿¿¡¼­ ¸ÅÅ©·Î·Î ±¸µ¿ °¡´ÉÇÏ°Ô ¹Ù²Ù´Â ÁßÀε¥ ÀüÇô¸ð¸£°Ú½À´Ï´Ù

DOSS   
   Á¶È¸ 2849   Ãßõ 0    

 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;고 

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

    Set Synergy = SynergyGetter.GetSASynergy

Else

    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 lName 

lName = StudyDoc.GetResultPrefix("Flow")

Dim lOutName

lOutName = lName & ".out" 


' 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

'       Total projected area                               = %11.4G

'    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    = " & CStr(MM.GetFloat(0)) 

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

'       Maximum injection pressure          (at %11.4G) = %11.4G

'    s,1,2

'    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 =     " & CStr(MM.GetFloat(0)) 

MsgBox CStr(lStr)


MsgBox "Script Complete"


' ---- Message class

Class Message

  Private mMSCD            ' MSCD Message ID

  Private mNumString    ' Number of Strings associated with the Message

  Private mNumFloat     ' Number of Floats  Associated with the Message

  Private mStrings()    ' The Strings Associated with the Message

  Private mFloats()        ' The Numerical Values Associated with the Message

  

  Public Sub SetMSCD(aMSCD)

    mMSCD = aMSCD

  End Sub

  

  Public Sub SetNumString(aNumString)

    mNumString = aNumString

  End Sub

  

  Public Sub SetNumFloat(aNumFloat)

    mNumFloat = aNumFloat

  End Sub

  

  Public Sub AddFloat(aFloat)

    mNumFloat = mNumFloat + 1

    ReDim Preserve mFloats(mNumFloat)

    mFloats(mNumFloat-1) = aFloat

  End Sub

  

  Public Sub AddString(aString)

    mNumString = mNumString + 1

    ReDim Preserve mStrings(mNumString)

    mStrings(mNumString-1) = aString

  End Sub

  

  Public Function GetMSCD()

      GetMSCD = mMSCD

  End Function

  Public Function GetString(aIndex)

    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 mNumMessages&#160; &#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;


ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.


QnA
Á¦¸ñPage 336/420
2021-03   1919   ploki0911
2020-05   2500   keros
2021-03   2736   GPGPU
2020-05   2750   È­Á¤Å¥»ï
2021-03   2472   ±è¿µ±â
2020-05   2421   ±è¿µ±â
2021-03   2613   ÇϴóʸÓ
2020-05   2604   W0011101
2021-03   2092   ÇãÀα¸¸¶Æ¾
2020-05   3126   Frinc
2021-03   2310   ºÀ·¡
2020-05   2666   petabyte
2021-03   2743   ¾Ë¼ö¾ø´ÂÈû
2020-05   2390   lovin09
2021-02   5645   °Ü¿ï³ª¹«
2020-05   2226   ±èÈ¿¼ö
2021-02   2077   ÀÌÀ±ÁÖ
2020-05   2502   SamP
2021-02   3149   theÃ̳ð
2020-05   2574   ¿ì·ç¸®·ç