jamesrains

Trouble applying ModelBuilder(VBScript) as a UIControl in ArcMap

Discussion created by jamesrains on May 24, 2010
First off, I'm search impaired.  I have searched and searched all over ESRI's site and the only topics I have found aren't working. (maybe I'm application impaired as well...)

Here's what I have going on.  I have created a ModelBuilder that calculates the FacilityID field equal to the ObjectID field for three SDE FeatureClasses in my map (see attached image).  I exported this into a VBScript, hoping to apply it to a UIControl in ArcMap.  Everything I have tried, based on what I have found in my searches, hasn't worked.  Sometimes it's a compile error but most of the time it's a Run-time error. 

Here's the VBScript code from ModelBuilder:
 
' ---------------------------------------------------------------------------
' CalcFacilityID.vbs
' Created on: Mon May 24 2010 03:11:11 PM
'   (generated by ArcGIS/ModelBuilder)
' Usage: CalcFacilityID <wPressurizedMain> <wFitting> <wLateralLine>
' ---------------------------------------------------------------------------

' Create the Geoprocessor object
Set GP = wscript.CreateObject("esriGeoprocessing.GPDispatch.1")

' Load required toolboxes...
GP.AddToolbox "C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx"

' Script arguments...
wPressurizedMain = wscript.arguments.item(0)
If wPressurizedMain = "#" Then
wPressurizedMain = "wPressurizedMain" ' provide a default value if unspecified
End If

wFitting = wscript.arguments.item(1)
If wFitting = "#" Then
wFitting = "wFitting" ' provide a default value if unspecified
End If

wLateralLine = wscript.arguments.item(2)
If wLateralLine = "#" Then
wLateralLine = "wLateralLine" ' provide a default value if unspecified
End If

' Local variables...
wPressurizedMain__2_ = "wPressurizedMain"
wFitting__2_ = "wFitting"
wLateralLine__2_ = "wLateralLine"

' Process: Calculate Field...
GP.CalculateField_management wPressurizedMain, "FacilityID", "[OBJECTID]", "VB", ""

' Process: Calculate Field (2)...
GP.CalculateField_management wFitting, "FacilityID", "[OBJECTID]", "VB", ""

' Process: Calculate Field (3)...
GP.CalculateField_management wLateralLine, "FacilityID", "[OBJECTID]", "VB", ""


How in the world do I apply this to a UIControl - and actually get it to work? 

Thanks in advance,
James Rains

Outcomes