Python equivalents to AML directives

Learn more about Python equivalents to AML functions

ABBREVIATIONS

AML directive

<not supported>

AMLPATH

AML directive

<not applicable>

ARGS < var ... var >

AML directive
import arcpy

arcpy.GetParameterAsText(var)

ATOOL

AML directive

<not applicable>

CALL

AML directive

<not applicable>

CODEPAGE ANSI

AML directive
import locale
locale.setlocale(locale.LC_ALL, "")

COMMANDS

AML directive
import arcpy
for tool in arcpy.ListTools():
    print tool

CONV_WATCH_TO_AML

AML directive

<not applicable>

DALINES

AML directive

<not applicable>

DATA

AML directive

exec or eval statements

DATEFORMAT

AML directive

Use various functions in the time module. See DATE -DFMT AML function for more information.

DELVAR < variable ... variable >

AML directive
del variable

DESCRIBE < geo_dataset >

AML directive
import arcpy

desc = arcpy.Describe(geo_dataset)
print desc.type

DO &LIST

AML directive
for <target> in <list>:
   <statements>

DO &REPEAT

AML directive
while <expression>:
    <statements>

DO &TO &BY

AML directive
for <target> in <list>:
    <statements>

DO &UNTIL < expression >

AML directive
while not <expression>:
    <statements>

DO &WHILE < expression >

AML directive
while <expression>:
    <statements>

DO

AML directive

for or while statements

ECHO

AML directive

<not applicable>

ENABLE

AML directive

<not applicable>

ENCODE

AML directive

<not applicable>

FLUSHPOINTS

AML directive

<not applicable>

FORMAT

AML directive

<not applicable>

FULLSCREEN

AML directive

<not applicable>

GETLASTPOINT

AML directive

<not applicable>

GETPOINT

AML directive

<not applicable>

GOTO

AML directive

<not applicable>

IACRETURN

AML directive

<not applicable>

IF THEN ELSE

AML directive
if <testcase1>:
    <statements1>
elif <testcase2>:
    <statements2>
else:
    <statements3>

LABEL

AML directive

<not applicable>

LISTCHAR

AML directive

<not applicable>

LISTFILES

AML directive

<not applicable>

LISTGLOBAL

AML directive

<not applicable>

LISTLOCAL

AML directive

<not applicable>

LISTPROGRAM

AML directive

<not applicable>

LISTVAR

AML directive

<not applicable>

MENU

AML directive

<not applicable>

MENUPATH

AML directive

<not applicable>

MESSAGES

AML directive

<not applicable>

PAUSE < prompt > &SECONDS < secs >

AML directive
import time
print prompt
time.sleep(secs)

POPUP <file> <string_list>

AML directive
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

AML directive

<use GetMessages method to get execution time of a tool>

PUSHPOINT

AML directive

<use geometry object and cursors to create and modify features>

RETURN

AML directive

<not applicable>

ROUTINE

AML directive

<not applicable>

RUN

AML directive

<not applicable>

RUNWATCH

AML directive

<not applicable>

SELECT

AML directive

<not applicable>

SELCHAR

AML directive

<not applicable>

SELVAR

AML directive

<not applicable>

SEVERITY

AML directive

<not applicable>

SHOW

AML directive

<not applicable>

STATION

AML directive

<not applicable>

STOP

AML directive

<not applicable>

SYSTEM < command >

AML directive
import os
os.system(command)

TB

AML directive

<not applicable>

TERMINAL

AML directive

<not applicable>

TEST

AML directive

<not applicable>

THREAD

AML directive

<not applicable>

TRANSLATE

AML directive

<not applicable>

TTY

AML directive

<not applicable>

TYPE < message >

AML directive
print message

USAGE < command >

AML directive
import arcpy
arcpy.Usage(command)

WATCH

AML directive

<not applicable>

WORKSPACE < path >

AML directive
from arcpy import env
arcpy.env.workspace = path

Related Topics


4/14/2011