HOW TO
Code:
'--- Script 1
'-- LIS.OwnRpt
'-- Creates a report of ownership for the currently selected
'-- records in the parcel theme
theView = av.GetActiveDoc
theTheme = theView.GetActiveThemes.Get(0)
theVtab = theTheme.GetFTab
theFieldsList = theVtab.GetFields
theVList = {}
for each F in theFieldsList
if(F.IsVisible) then
theVList.Add(F.AsString)
end
end
'-- Edit the pathname in the next line as appropriate
theWFile = FileDialog.Put("c:\windows\owner.rpt".AsFileName, "*.rpt".AsPattern,
"Report File")
if (theWFile = nil) then
exit
end
'-- Add the fields to be written to the file, to a list
'-- Edit the names in parentheses to match the items in your tables
theGoodFields = {}
theGoodFields.Add("Re_")
theGoodFields.Add("Owner1")
theGoodFields.Add("Owner2")
theGoodFields.Add("O-Address")
theGoodFields.Add("O-city")
theGoodFields.Add("O-state")
theGoodFields.Add("O-zip")
theGoodFields.Add("S-address")
'-- Edit the title in the next line to fit your needs
theTitle = MsgBox.Input("Please Enter a Title for the Report", "Enter Title",
"Parcel Ownership Report")
theDate = Date.Now.SetFormat("MM/dd/yyyy")
theRptList = {}
for each rec in theVtab.GetSelection
for each f in theVTab.GetFields
str = theVTab.ReturnValue(f, rec)
if (theGoodFields.FindByValue(f.AsString) <> -1) then
theRptList = theRptList.Add(f.AsString++" = "++str.AsString)
'-- adds a space between records in the report
if (f.AsString = "S-address") then
theRptList = theRptList.Add(" ")
end
end
end
end
lf = LineFile.Make(theWFile, #FILE_PERM_WRITE)
lf.GoToBeg
lf.WriteElt(theTitle++tab++tab++theDate.AsString)
lf.WriteElt(nl)
lf.Write(theRptList, theRptList.Count)
lf.Close
av.ShowMsg("Report written to"++theWFile.AsString)
'--- End of Script 1
Code:
'--- Script 2
'--- LIS.TextFile
'-- Writes the selected file onto a Layout in the
'-- rectangle selected by the user.
theLayout = av.GetActiveDoc
if (theLayout.GetGraphics.EditText.Not) then
userRect = theLayout.GetDisplay.ReturnUserRect
theRFileName = FileDialog.Show("*.*", "All Files", "Get File")
if (theRFileName = nil) then exit end
txtsym = TextSymbol.Make
txtsym.SetFont(Font.Make("Arial", "Normal"))
txtsym.SetSize(12)
theRFile = TextFile.Make(theRFileName, #FILE_PERM_READ)
theString = theRFile.Read(theRFile.GetSize)
t = GraphicText.Make(theString, userRect.ReturnOrigin)
t.SetDisplay(theLayout.GetDisplay)
theLayout.GetGraphics.UnselectAll
t.SetSelected(TRUE)
theLayout.GetGraphics.AddName(t)
t.SetBounds(userRect)
t.SetSymbols({txtsym})
t.SetSelected(FALSE)
end
'--- End of Script 2
Article ID:000001487
Get help from ArcGIS experts
Download the Esri Support App