Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

automation inteface events


2 replies to this topic

dalkema

dalkema
  • Full Members
  • 9 posts

Posted 31 October 2005 - 19:22

Is it possible to catch the StatusMessage event in a VbScript? I have the following code that is not working:

Sub BuildISXProject(sMyProject, sTarget)
Dim pProject
LogMsg "Building " & sMyProject

'This should allow for the event handler. But the event is in the release
'object, not the project.
Set pProject = WScript.CreateObject("SAAuto10.ISWiProject", "event_")

pProject.OpenProject sMyProject, True
LogMsg "Opened " & sMyProject

Dim pProdConfig
Set pProdConfig = pProject.ISWiProductConfigs.Item("Standard")
LogMsg "Set ProdConfig to Standard"

'Here, we should loop through all of the release items in Standard and build them
Dim pRelease, nReleaseCount, i
nReleaseCount = pProdConfig.ISWiReleases.Count
LogMsg "About to build " & CStr(nReleaseCount) & " releases"
for i=1 to nReleaseCount
Set pRelease = pProdConfig.ISWiReleases.Item(i)
LogMsg "About to build " & pRelease.Name
pRelease.BuildLocation=sTarget
pRelease.Build
LogMsg "There were " & CStr(pRelease.BuildErrorCount) & " errors in the build."
LogMsg "Finished building " & pRelease.Name
next
'Set pRelease = pProdConfig.ISWiReleases.Item("Standard")
'LogMsg "Set release to Standard"

'pRelease.Build
LogMsg "Built " & sMyProject & "; Config=Standard; Item=Standard"

end sub

Sub event_StatusMessage(sMessage, pbCancel)
LogMsg("Build Message: " & sMessge)
end sub


dalkema

dalkema
  • Full Members
  • 9 posts

Posted 31 October 2005 - 21:17

OK, I have this one solved. So here it is for posterity. Add the line in red to the previously posted code to use the WScript.ConnectObject method:

LogMsg "About to build " & CStr(nReleaseCount) & " releases"
for i=1 to 1
Set pRelease = pProdConfig.ISWiReleases.Item(i)
WScript.ConnectObject pRelease, "event_"
LogMsg "About to build " & pRelease.Name
pRelease.Build
LogMsg "There were " & CStr(pRelease.BuildErrorCount) & " errors in the build."
LogMsg "Finished building " & pRelease.Name
next


antyagi

antyagi
  • Full Members
  • 121 posts

Posted 07 November 2005 - 05:26

can you tell me what is this "LogMsg"? wacko.gif
Will it display the message or will it save the message in some text file?
  ankur tyagi