Using Setting Script Tool Parameters Using Python and ArcGIS 9.3.1? I was able to properly set up the parameters of a script tool.
I would like to get the same dialog box from the script tool to appear when used from a button in ArcMap 9.3.1.
I know how to create a button and getting working, but only if it does not contain parameters. I'm assuming that this customization needs to be carried out using VB, or whatever other language.
Is there some generic code that can be used to create the same dialog box as the one that appears in the script tool?
I'm not a programmer (although I can hack may way through stuff in Python) so I don't know where to start.
-
You'll have to upgrade to 10.0 if you want to do this without programming.blah238– blah2382012年08月31日 23:59:58 +00:00Commented Aug 31, 2012 at 23:59
1 Answer 1
This article shows how to do this in VBA (which you should be aware was removed at 10.1 and requires authorization at 10.0):
Private Sub UIButtonControl1_Click()
'Ensure that there are references set to the
'ESRI GeoprocessingUI Object Library and the
'ESRI Geoprocessing Object Library.
'Go to Tools > References to do this
Dim pUID As New UID
pUID = "esriGeoprocessingUI.ArcToolboxExtension"
Dim pATBExt As IArcToolboxExtension
Set pATBExt = Application.FindExtensionByCLSID(pUID)
Dim pAtb As IArcToolbox
Set pAtb = pATBExt.ArcToolbox
Dim pTool As IGPTool
'* Use this line for custom tools or models
'* ========================================
Set pTool = pAtb.GetToolbyNameString("MyModel")
'* Use this line for existing tools
'* ================================
'Set pTool = pAtb.GetToolbyNameString("buffer_analysis")
Dim pCommand As IGPToolCommandHelper
Set pCommand = New GPToolCommandHelper
pCommand.SetTool pTool
pCommand.Invoke Nothing
End Sub
Explore related questions
See similar questions with these tags.