Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Thanks to Jason 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.

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.

So, 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.

share|improve this question
    
You'll have to upgrade to 10.0 if you want to do this without programming. –  blah238 Aug 31 '12 at 23:59
add comment

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
This is great. Can't quite figure out where I should be calling the script. I've used this for my button when not using parameters. –  dchaboya Sep 4 '12 at 15:41
    
Got it working. Within the properties of the tool, the names for Name and Label where different. I just had to make them the same. –  dchaboya Sep 4 '12 at 17:47
    
Good to hear -- if the answer worked for you, please mark it as accepted by clicking the check mark icon by it. –  blah238 Sep 4 '12 at 22:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.