Archived Boards > COM Automation and dotNet

Assigning value to object nets "Expression continues past expected end"


I am trying to assign a value to a task sequence variable.  I've created the Microsoft.SMS.TSEnvironment object, I've verified it's a valid object, but when I try to assign it a value, I get "Expression continues past expected end.  I'm using a Winbatch variables for both my task sequence variable name and value.  I thought that might be a problem, so I tried hardcoding the name and value.  No joy.  Why is this happening to me?  Is there a better way to verify that this object is legit?

--- Code: ---#DefineFunction UDF_CreateTSVariable(vstrTSVariable,vstrValue)

; Set the program to goto the WBErrorHandler function if there is a problem.

; Resume DebugTrace (if it was already active)

vobjTSE = CreateObject("Microsoft.SMS.TSEnvironment")
vintObjectType = VarType(vobjTSE)
If (vintObjectType & 1536) != 1536 || vintObjectType == 0 Then
vobjTSE(vstrTSVariable) = vstrValue
If StriCmp(vobjTSE(vstrTSVariable),vstrValue) == 0 Then
End If
End If


--- End code ---

You are attempting to use VB syntax in WinBatch.  WinBatch does not support magic-default-object-method syntax (something that some of the original VB implementers now admit was a mistake.)  So you need to figure out the name of the actual method being called when you attempt the assignment.  One way to do that is to use the WIL Type Viewer to examine the classes and objects involved.   


[0] Message Index

Go to full version