Home arrow Site Info arrow Latest Portal Content arrow Run Python Script As a Scheduled Task
Run Python Script As a Scheduled Task PDF Print E-mail

Written by AGRC Administrator,

 From the Windows Control Panel, open the Scheduled Task folder and double click on the Add Scheduled Task item.

 A wizard will guide you through setting the parameters for the scheduled task including the program to run, the time and frequency, and the username and password for the machine that you want to run the scheduled task on. You can right click on a scheduled task to run the task manually to test it.

If python is properly registered on your computer this should be enough. You may, however, have to set the Run paramter up to reference both the python executable and the python script containing your code like this (below). Either should work.

C:\Python24\python.exe C:\myscripts\python\mypythonscript.py

# ---------------------------------------------------------------------------
# rebuildgeocoders.py
# Created on: Thu Oct 25 2007 02:47:27 PM
#   (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Geocoding Tools.tbx")


# Local variables...
U024_GC_StatewideStreets = "Database Connections\\DC_U024@ This e-mail address is being protected from spam bots, you need JavaScript enabled to view it _StatewideStreets"
U024_GC_StatewideStreets_ACS = "Database Connections\\DC_U024@ This e-mail address is being protected from spam bots, you need JavaScript enabled to view it _StatewideStreets_ACS"
U024_GC_StatewideStreets_Alias2 = "Database Connections\\DC_U024@ This e-mail address is being protected from spam bots, you need JavaScript enabled to view it _StatewideStreets_Alias2"
U024_GC_StatewideStreets_Alias1 = "Database Connections\\DC_U024@ This e-mail address is being protected from spam bots, you need JavaScript enabled to view it _StatewideStreets_Alias1"

# Process: Rebuild Address Locator...
gp.RebuildAddressLocator_geocoding(U024_GC_StatewideStreets)

# Process: Rebuild Address Locator (2)...
gp.RebuildAddressLocator_geocoding(U024_GC_StatewideStreets_ACS)

# Process: Rebuild Address Locator (3)...
gp.RebuildAddressLocator_geocoding(U024_GC_StatewideStreets_Alias2)

# Process: Rebuild Address Locator (4)...
gp.RebuildAddressLocator_geocoding(U024_GC_StatewideStreets_Alias1)

Users' Comments  
 

No comment posted

Add your comment

25, Oct. 2007
Last Updated ( 03, Jan. 2008 )
 
< Prev   Next >

AGRC Contacts | UGIC Contacts

feed image feed image

Utah GIS Portal © 2009 AGRC

Optimized for