Carl,
I have two scripts in my \system\ArcPad.apx.
The first in the .vbs script is as follows:
Option Explicit
Sub AddSturgeonTags
Dim dblX, dblY, objToolButton, blnLyrExists
'Get a reference to the tool button object
Set objToolButton = ThisEvent.Object
'Initialize blnLyrExists flag to False
blnLyrExists = False
'If SturgeonTags layer exists,
'set the blnLyrExists flag to true
Dim objLyr
For Each objLyr in Map.Layers
If StrComp (objLyr.Name, "Water", 1) = 0 Then
blnLyrExists = True
Exit For
End If
Next
'If ISturgeonTags layer does not exist:
'Notify the user, return the tool button to its original state, and exit.
If Not blnLyrExists Then
MsgBox "Water layer is not present in the current map.", vbExclamation, "Layer not present"
objToolButton.Click
Exit Sub
End If
'If the ISturgeonTags layer does exist:
'Get the coordinates of the map where the user clicked
dblX = Map.PointerX
dblY = Map.PointerY
'Get a reference to the Invasive Plants Layer object
Dim objLayer
Set objLayer = Map.Layers("Water")
'If the layer can be made editable, make it editable
If objLayer.CanEdit Then
objLayer.Editable = True
'Add a new Invasive Plant (point feature) at the clicked location
Call Map.AddFeatureXY(dblX,dblY)
'Return the tool button to its original state
objToolButton.Click
End If
End Sub
The second is added onto the .apx config file SystemObjects
maps as an onfeatureadded script
Dim MyCoordSys
Dim objRS
Set MyCoordSys = Application.Map.CoordinateSystem
Set objRS = Map.Selectionlayer.Records
objRS.Bookmark = Map.SelectionBookmark
If Left(objRS.Fields.ShapeType, 1) = 1 Then
If MyCoordSys.GeographicName = "GCS_WGS_1984" Then
For Each f in objRS.Fields
If f.name = "X" Then
f.Value = objRS.Fields.Shape.Y
ElseIf f.name = "Y" Then
f.Value = objRS.Fields.Shape.X
ElseIf f.name = "Z" Then
f.Value = GPS.Z
ElseIf f.name = "LATITUDE" Then
f.Value = objRS.Fields.Shape.Y
ElseIf f.name = "LONGITUDE" Then
f.Value = objRS.Fields.Shape.X
ElseIf f.name = "ALTITUDE" Then
f.Value = GPS.Altitude
End If
Next
Else
For Each f in objRS.Fields
If f.name = "X" Then
f.Value = objRS.Fields.Shape.X
ElseIf f.name = "Y" Then
f.Value = objRS.Fields.Shape.Y
ElseIf f.name = "Z" Then
f.Value = GPS.Z
ElseIf f.name = "LATITUDE" Then
f.Value = objRS.Fields.Shape.X
ElseIf f.name = "LONGITUDE" Then
f.Value = objRS.Fields.Shape.Y
ElseIf f.name = "ALTITUDE" Then
f.Value = GPS.Altitude
End If
Next
End If
End If
objRS.Update
Map.Refresh(True)
The second script will add the XY or Z of the point IF you have either an X , Y and or Z ( or Latitude, Longitude, Altitude) attribute field in your .dbf
Hope this helps,
Eric