During the OpenFlight User Group Meeting at I/ITSEC on 11/30/2011, tips and tricks were presented for using OpenFlight Script and Creator Script.
Here is a script presented that shows how to process multiple OpenFlight database files without using the Creator Pro command Batch Run Script. Note that you can use this technique to apply OpenFlight Script commands to your databases but you cannot invoke Creator Script commands in this way.
def ProcessNodeCB (db, parent, rec, userData):
# this "mgWalk" callback processes each node visited
type = mgGetCode (rec)
if (type == fltPolygon):
# do something to the polygon
print "Processing polygon:", mgGetName(rec)
def ProcessOneFile (db):
print "Processing file:", mgRec2Filename(db)
mgWalk (db, ProcessNodeCB, None, None, MWALK_NOREADONLY)
outs = mgPromptDialogFile (None,
MPFA_PATTERN, "OpenFlight Files|*.flt",
MPFA_TITLE, "Select OpenFlight Files to Process" )
status = outs
numFiles = outs
fileNames = outs[2:len(outs)]
for fileName in fileNames:
db = mgOpenDb (fileName)
print "User Canceled"