How To: Hotlink to a project and open the imported views
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.
- Open a new script window. A. Activate the Project window.
B. Click the Scripts icon.
C. Click New.
- Copy the following code into the new window:
'-- 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.
for each d in theODL
'-- 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.
MsgBox.Info("This feature has no project mentioned in the table","Error")
'-- Make a list of all the views in the project after importing.
for each do in theNDL
'-- Compare the new view list to the old view list.
'-- Isolate those that are new, and open them.
for each v in theNVL
for each uv in theUVL
- Click the Compile button.
- Make the view and theme active.
- Select Properties from the Theme menu.
- Click the HotLink icon.
- Select the name of the hotlink field in the Field dropdown list.
The values in the hotlink field must be the path to the apr file. For example: c:\temp\proj1.apr.
- Select Link to User Script in the Predefined Action dropdown list.
- Click the Load System Script button.
- Select the hotlink script and click OK.
- Click OK in the Theme Properties dialog.