HOW TO
This document shows how to hotlink to:
Note: See "Setting up and using hot links" (pages 134 and 135) in the "Using ArcView GIS" book.
'-- This script hotlinks to another project and then opens the views. '-- SELF is the path to the project file mentioned in the '-- feature's hot link field. theVal= SELF '-- Make a list of the views that are currently 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, '-- then 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=-1) then theUVL.Add(v) end end for each uv in theUVL uv.getwin.open end
'-- When used as a hotlink script, the value of the hotlink '-- field for the chosen feature must be the full pathname to a '-- raster file format supported by the view document. theVal = SELF if (Not (theVal.IsNull)) then if (File.Exists(theVal.AsFileName)) then srcImage = SrcName.Make(theVal) t = Theme.Make(srcImage) t.SetVisible(TRUE) v = View.Make v.AddTheme(t) v.SetTOCWidth(0) v.SetTOCUnresizable(TRUE) v.SetName(theVal.AsFileName.GetBaseName) if (av.FindScript("View.CloseImageView") = NIL) then s = Script.Make("av.GetProject.RemoveDoc(SELF)") s.SetName("View.CloseImageView") av.GetProject.AddScript(s) end v.SetCloseScript("View.CloseImageView") '-- If you've created a special GUI for this document, '-- activate here using something like this: '-- v.SetGUI("aNewGUIName") '-- av.FindGUI(v.GetGUI).Activate v.GetWin.Open else MsgBox.Warning("File "+theVal+" not found.","Hot Link") end end atool = av.GetProject.FindGui("View").GetToolBar.FindByScript("View.Select") atool.Select
'-- Use this script to hotlink a external file '-- Modify the path to executable to on your machine linkfile = Self exeString = "c:\program files\microsoft office\office\winword.exe" ++ linkfile System.Execute(exeString)
Note: No hotlink field should be specified in the Theme's Hotlink Properties.
'-- Script: VIEW.MULTITOOLAPPLY ' '-- This script requires that the CAD Reader extension is turned on. theView = av.GetActiveDoc found = FALSE listofFieldNames = {"BMPfield","Textfield","DWGfield"} '-- Edit the field names above to match yours listofValues = {} p = theView.GetDisplay.ReturnUserPoint t = theView.GetActiveThemes.Get(0) if (t.Is(FTheme)) then found = TRUE theFtab = t.GetFTab rec = t.FindByPoint(p).Get(0) for each f in listofFieldNames theVal = theFTab.ReturnValueString(theFTab.FindField(f),rec) if (theVal <> NIL) then listofValues.Add(theVal) else listofValues.Add("a") end end end av.Run(t.GetHotScriptName,listofValues) if (not found) then System.Beep end
'-- Script: VIEW.MULTITHEMEPROP ' theBMPFileName = Self.Get(0) theTextFileName = Self.Get(1) theDXFFileName = Self.Get(2) MsgBox.Info("One moment please..." +NL+"Hit OK to continue.","Multi Hotlink") '-- For BMP Image if (File.Exists(theBMPFileName.AsFileName)) then theImageWin = ImageWin.Make(theBMPFileName.AsFileName,theBMPFileName) else MsgBox.Info("There is no Image File","") end '-- For Text File if (File.Exists(theTextFileName.AsFileName)) then theTextWin = TextWin.Make(theTextFileName.AsFileName,theTextFileName) else MsgBox.Info("There is no Text File","") end '-- For DXF drawing if (File.Exists(theDXFFileName.AsFileName)) then srcDrawingLine = SrcName.Make(theDXFFileName ++ "line") srcDrawingPoint = SrcName.Make(theDXFFileName ++ "point") srcDrawingPoly = SrcName.Make(theDXFFileName ++ "polygon") srcDrawingAnno = SrcName.Make(theDXFFileName ++ "annotation") tPoly = Theme.Make(srcDrawingPoly) tLine = Theme.Make(srcDrawingLine) tPoint = Theme.Make(srcDrawingPoint) tAnno = Theme.Make(srcDrawingAnno) v = View.Make v.AddTheme(tPoly) v.AddTheme(tLine) v.AddTheme(tPoint) v.AddTheme(tAnno) tLine.SetVisible(TRUE) tPoint.SetVisible(TRUE) tPoly.SetVisible(TRUE) tAnno.SetVisible(TRUE) v.SetTOCWidth(45) v.SetTOCUnresizable(FALSE) v.SetName(theDXFFileName) if (av.FindScript("View.CloseImageView") = NIL) then s = Script.Make("av.GetProject.RemoveDoc(SELF)") s.SetName("View.CloseImageView") av.GetProject.AddScript(s) end v.SetCloseScript("View.CloseImageView") theDXFWin = v.GetWin theDXFWin.Resize(310,260) theDXFWin.MoveTo(300,50) else MsgBox.Info("There is no Drawing to open","") theDXFWin = nil end '-- Open the windows if (theImageWin <> nil) then theImageWin.Open theImageWin.Resize(240,180) theImageWin.MoveTo(1,100) end if (theTextWin <> nil) then theTextWin.Open theTextWin.Resize(240,180) theTextWin.MoveTo(21,100) end if (theDXFWin <> nil) then theDXFWin.Open end
Get help from ArcGIS experts
Download the Esri Support App