HOW TO

Enter special characters into a UNIX AV Text Properties window? [SCRIPT]

Last Published: April 26, 2020

Procedure

Question: How to enter special characters into a Text Properties window.
Cause:

Unix machines, unlike PC's, do not have a character mapper; Unix machines also lack 'special' keyboard combinations to enter values directly into the window.

Answer:

The following set of scripts are a modified version of the regular view and layout text tools that accepts a list of ascii values, converts them and enters them into the Text Properties window. Create new tools in the view and layout and attach these scripts accordingly.
 
' View.TextTool(ASCII)
'

theView = av.GetActiveDoc
if (theView.GetGraphics.EditText.Not) then
pt = theView.GetDisplay.ReturnUserPoint

' ask for ascii value and convert
newstr = ""
strlist = msgbox.input("Enter ASCII values (0-255) separated by commas:","ASCII value(s)...","")
if(strlist = nil) then exit end
for each astr in strlist.astokens(",")
if(astr.isnumber) then
goodstr = astr.asnumber
if((goodstr < 0) or (goodstr > 255)) then
msgbox.error(goodstr.asstring++" is not between 0 and 255","Bad Value")
continue
end
newstr = newstr ++ goodstr.aschar
else
msgbox.error(astr++"is not a valid numeric value...","Bad value")
continue
end
end

t = GraphicText.Make(newstr, pt)
t.SetDisplay(theView.GetDisplay)
theView.GetGraphics.UnselectAll
t.SetSelected(TRUE)
if (t.EditText) then
theView.GetGraphics.Add(t)
end
av.GetProject.SetModified(true)
end
' Layout.Text(ASCII)
'

theLayout = av.GetActiveDoc
if (theLayout.GetGraphics.EditText.Not) then
pt = theLayout.GetDisplay.ReturnUserPoint
' ask for ascii value and convert
newstr = ""
strlist = msgbox.input("Enter ASCII values (0-255) separated by commas:","ASCII value(s)...","")
if(strlist = nil) then exit end
for each astr in strlist.astokens(",")
if(astr.isnumber) then
goodstr = astr.asnumber
if((goodstr < 0) or (goodstr > 255)) then
msgbox.error(goodstr.asstring++" is not between 0 and 255","Bad Value")
continue
end
newstr = newstr ++ goodstr.aschar
else
msgbox.error(astr++"is not a valid numeric value...","Bad value")
continue
end
end

t = GraphicText.Make(newstr, pt)
t.SetDisplay(theLayout.GetDisplay)
theLayout.GetGraphics.UnselectAll
t.SetSelected(TRUE)
if (t.EditText) then
theLayout.GetGraphics.AddName(t)
av.GetProject.SetModified(true)
end
end


 

Article ID:000001502

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic