Python equivalents to AML directives
Learn more about Python equivalents to AML functions
ABBREVIATIONS |
<not supported>
AMLPATH |
<not applicable>
ARGS < var ... var > |
import arcpy arcpy.GetParameterAsText(var)
ATOOL |
<not applicable>
CALL |
<not applicable>
CODEPAGE ANSI |
import locale locale.setlocale(locale.LC_ALL, "")
COMMANDS |
import arcpy for tool in arcpy.ListTools(): print tool
CONV_WATCH_TO_AML |
<not applicable>
DALINES |
<not applicable>
DATA |
exec or eval statements
DATEFORMAT |
Use various functions in the time module. See DATE -DFMT AML function for more information.
DELVAR < variable ... variable > |
del variable
DESCRIBE < geo_dataset > |
import arcpy desc = arcpy.Describe(geo_dataset) print desc.type
DO &LIST |
for <target> in <list>: <statements>
DO &REPEAT |
while <expression>: <statements>
DO &TO &BY |
for <target> in <list>: <statements>
DO &UNTIL < expression > |
while not <expression>: <statements>
DO &WHILE < expression > |
while <expression>: <statements>
DO |
for or while statements
ECHO |
<not applicable>
ENABLE |
<not applicable>
ENCODE |
<not applicable>
FLUSHPOINTS |
<not applicable>
FORMAT |
<not applicable>
FULLSCREEN |
<not applicable>
GETLASTPOINT |
<not applicable>
GETPOINT |
<not applicable>
GOTO |
<not applicable>
IACRETURN |
<not applicable>
IF THEN ELSE |
if <testcase1>: <statements1> elif <testcase2>: <statements2> else: <statements3>
LABEL |
<not applicable>
LISTCHAR |
<not applicable>
LISTFILES |
<not applicable>
LISTGLOBAL |
<not applicable>
LISTLOCAL |
<not applicable>
LISTPROGRAM |
<not applicable>
LISTVAR |
<not applicable>
MENU |
<not applicable>
MENUPATH |
<not applicable>
MESSAGES |
<not applicable>
PAUSE < prompt > &SECONDS < secs > |
import time print prompt time.sleep(secs)
POPUP <file> <string_list> |
from Tkinter import * def PopupList(title, list): root = Tk() root.title(title) root.protocol("WM_DELETE_WINDOW", root.quit) frame = Frame(root) vScrollbar = Scrollbar(frame, orient=VERTICAL) hScrollbar = Scrollbar(frame, orient=HORIZONTAL) listbox = Listbox(frame, selectmode=SINGLE, xscrollcommand=hScrollbar.set, yscrollcommand=vScrollbar.set) vScrollbar.config(command=listbox.yview) vScrollbar.pack(side=RIGHT, fill=Y) hScrollbar.config(command=listbox.xview) hScrollbar.pack(side=BOTTOM, fill=Y) listbox.pack(side=LEFT, fill=BOTH, expand=1) frame.pack() for a in list: listbox.insert(END, a) root.mainloop() root.destroy() file = sys.argv[1] string_list = sys.argv[2] # semi-colon delimited string sList = l.split(";") f = open(file, 'r') line = f.readline() while len(line) <> 0: sList.append(line) line = f.readline() PopupList(file, sList)
PT |
<use GetMessages method to get execution time of a tool>
PUSHPOINT |
<use geometry object and cursors to create and modify features>
RETURN |
<not applicable>
ROUTINE |
<not applicable>
RUN |
<not applicable>
RUNWATCH |
<not applicable>
SELECT |
<not applicable>
SELCHAR |
<not applicable>
SELVAR |
<not applicable>
SEVERITY |
<not applicable>
SHOW |
<not applicable>
STATION |
<not applicable>
STOP |
<not applicable>
SYSTEM < command > |
import os os.system(command)
TB |
<not applicable>
TERMINAL |
<not applicable>
TEST |
<not applicable>
THREAD |
<not applicable>
TRANSLATE |
<not applicable>
TTY |
<not applicable>
TYPE < message > |
print message
USAGE < command > |
import arcpy arcpy.Usage(command)
WATCH |
<not applicable>
WORKSPACE < path > |
from arcpy import env arcpy.env.workspace = path