I try to automate an Encoding Session of a Windows Media Encoder server. Some functions are just working fine, but some are giving kixtart errors, like the following.

001 $Encoder = CreateObject("WMEncEng.WMEncoder")
002 $pBroadccast=$Encoder.broadcast
003 $p1=”\\servername\share\MyPubPoint.nsc”
004 $p2=”\\MyComputer\MyPubPoint.asx”
005 ? vartype($Encoder)
006 ? vartype($pBroadccast)
007 $pBroadcast.GenerateAnnoucementFile($p1, $p2)

Executing lignes 005 and 006 gives 9
When executing line 007, I get the following message :

ERROR : expected ‘)’ !


To write these lines, I took as a starting point the following Visual Basic source coming from the Media Encoder SDK.
 Code:
= = = START SOURCE = = = 
' Declare variables.
  Dim Encoder As WMEncoder
  Dim SrcGrpColl As IWMEncSourceGroupCollection
  Dim SrcGrp As IWMEncSourceGroup2
  Dim SrcAud As IWMEncAudioSource
  Dim SrcVid As IWMEncVideoSource
  Dim ProColl As IWMEncProfileCollection
  Dim Pro As IWMEncProfile
  Dim PushDist As IWMEncPushDistribution
  Dim strServerName As String
  Dim strPubPoint As String
  Dim strPubTemplate As String
  Dim MyNSCFile As String
  Dim MyNSCURL As String
  Dim MyASXFile As String

Private Sub Main()
' Create a WMEncoder object.
  Set Encoder = New WMEncoder

' Retrieve the source group collection and add sources. 
' Use the default devices for the audio and video sources.
  Set SrcGrpColl = Encoder.SourceGroupCollection
  Set SrcGrp = SrcGrpColl.Add("SG_1")
  Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
  Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
  SrcAud.SetInput ("device://default_audio_device")
  SrcVid.SetInput ("device://default_video_device")

' Retrieve the profile collection. This example uses the 3rd profile.
  Set ProColl = Encoder.ProfileCollection
  Set Pro = ProColl.Item(2)
  SrcGrp.Profile = Pro

' Set up the push broadcast.
  Set PushDist = Encoder.Broadcast

' Specify the push distribution variables, including the Windows Media
' server name, publishing point, and announcement files. 
' Provide real values for the following placeholders.
  strServerName = "MyWMServer:70"
  strPubPoint = "MyPubPoint"
  strPubTemplate = "AnotherPubPoint"
  MyNSCFile = "\\servername\share\MyPubPoint.nsc"
  MyNSCURL = "\\servername\share\MyPubPoint.nsc"
  MyASXFile = "\\MyComputer\MyPubPoint.asx"

' Remove the publishing point when the broadcast is over.
  PushDist.AutoRemovePublishingPoint = True

' Set the push distribution variables.
  PushDist.ServerName = strServerName
  PushDist.PublishingPoint = strPubPoint
  PushDist.Template = strPubTemplate
  Encoder.PrepareToEncode True

' Generate the announcement file. 
  PushDist.GenerateMulticastInfoFile (MyNSCFile)
  PushDist.GenerateAnnouncementFile MyNSCURL, MyASXFile

' Start encoding.
  Encoder.Start
  MsgBox "Click OK to stop broadcasting."

End Sub

= = = END SOURCE = = = 

Is somebody able to give me an explanation why the call to the function GenerateAnnoucementFile is not working.

Thanks a lot for your collaboration.

Ralph