HOW TO
The 'Link.Project' system script imports the project but it doesn't open the documents, they must be opened by the user.
The script below allows the hotlink to import the project and opens only the imported views.
Code:
'-- Script: Link.ProjectOpenViews
'-- SELF is the path to the project file mentioned in the feature's hot link field.
theVal = SELF
'-- Make a list of the views in the project before importing.
theODL=av.Getproject.getdocs
theOVL=List.Make
for each d in theODL
if (d.is(View))
then theOVL.Add(d)
end
end
'-- If the hotlink field for the selected feature has no path,
'-- report a message and exit. Otherwise, convert
'-- the SELF string to a FileName and import the project.
if (theVal.IsNull.not)
then
av.GetProject.Import(theVal.AsFileName)
else
MsgBox.Info("This feature has no project mentioned in the table","Error")
exit
end
'-- Make a list of all the views in the project after importing.
theNDL=av.getproject.getdocs
theNVL=List.Make
for each do in theNDL
if (do.is(View))
then theNVL.Add(do)
end
end
'-- Compare the new view list to the old view list.
'-- Isolate those that are new, and open them.
theUVL=List.Make
for each v in theNVL
theNum=theOVL.Find(v)
if (theNum=FALSE)
then theUVL.Add(v)
end
end
for each uv in theUVL
uv.getwin.open
end
Note:
The values in the hotlink field must be the path to the apr file. For example: c:\temp\proj1.apr.
Article ID:000004206
Get help from ArcGIS experts
Download the Esri Support App