How to execute command line from ModelBuilder?

1312
4
04-25-2011 06:58 AM
MarilynGambone
New Contributor
Hi,

I want to execute a command line tool from ModelBuilder.  How do I do this?

Thanks...
0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus
If it exists within arctoolbox, then you use it.  what exactly is it that you want to do?
0 Kudos
MarilynGambone
New Contributor
There is a tool, wget (http://water.weather.gov/precip/download.php) that I want to use. 

This tool downloads multiple files from the website.  I want to chain this tool with other tools I'm using in Modelbuilder:  So the task of downloading the files to conversion to rasters is automated.
0 Kudos
Luke_Pinner
MVP Regular Contributor
1. Create a new toolbox and add it to the ArcToolbox tree. Right click on the new toolbox and select Add->Script... Add the path to wget (or a batch file that runs wget) to the "Script File:" text box on the 2nd page of the dialog. Add any arguments on the third page (you can set defaults so you don't always have to type stuff in) and click Finish.

2. Write a Python script that calls wget using the subprocess.Popen() class (or use urllib to download your files directly). This way you can return an output value to ArcGIS.
0 Kudos
MarilynGambone
New Contributor
Hi,

Thanks for your reply.  I've actually figured it out, too.  But I didn't have to create a Python script.  The command line just launches from the script.  I also checked the box to always run the script in foreground; otherwise, it ties up ArcCatalog. 

Again, thanks.

Marilyn
0 Kudos