I work for a city government using ArcGIS. For a long while, we had a lot of success with our engineers using the HotlinkImage script, pre-ArcGIS 10. The script allows the user to click a feature from a polygon dataset with a path to a folder full of referenced .tif images, and add the image associated with that feature into the map as a raster layer. Now that VBA is no longer supported, we have not been able to find a workaround to restore this functionality.
I am wondering if anyone else out there has had the same troubles, but has been able to figure out a solution. It seems like it should be a simple conversion to VB.Net (for someone other than me anyways :D), but I have scoured the forums and sample pages and have only found a few unanswered posts on the subject.
Has ANYONE out there been able to convert/adapt this script, or would anyone mind looking the VBA code over and doing whatever needs to be done to it to make it useable, and then reposting the new code here. This is something we've been trying to get back for almost 2 years now, I'm actually quite surprised to find that it hasn't been done yet.
I just want to share some observations I have made with this so that if someone wants to take a stab at it, they can create an ArcMap Add-in tool that would perform the same or near same functionality, or so you can give it a try, as well. I never used this Hyperlinks VBA macro but I took a look at the ReadMe provided by the author and I took a look at the VBA code in the .bas file.
The hotlinkimage you mention here (http://arcscripts.esri.com/details.asp?dbid=11848) is essentially a VBA macro which was to be imported into the Project of the VB Editor in ArcMap 9.3.1 and prior. Once imported in the Project, one would specify the name of that imported macro in Layer Properties dialog of a feature layer > Display tab > Hyperlinks section > check Support Hyperlinks using field > select Macro and specify the macro as "Project.modHotLinkImage.HotlinkImage"
One would then use the Hyperlink tool of ArcMap to fire that VBA Macro. The Hyperlink tool already did the job of passing to the VBA Macro (Sub Procedure) an IHyperlink object (which contains the hyperlink string value like "C:\Images\imagA.jpg") and an IFeatureLayer object which references the selected feature layer in the TOC (a layer in the TOC highlights in blue when selected). Since the Hyperlink tool already did the job of passing the IHyperlink object to the VBA macro, it definitely looks like the Hyperlink tool took care of determining which feature in the selected feature layer was clicked in the map so that it could get the hyperlink string value from that feature's row in the attribute table.
Although the VBA Macro itself is extremely simple to rewrite in VB.NET (or C#), it would not be enough to just convert it to VB.NET. One would have to develop an Add-in tool or custom component tool that would essentially perform the job I mention in the previous paragraph that the Hyperlink tool did. This is because the Hyperlink tool in 10.0 and forward does not accomodate VBA Macros anymore and we can say there is no such thing as a VB.NET macro. All you can specify now in the Hyperlinks section of a feature layer is a JScript or VBScript script and those will not work with ArcObjects (IHyperlink, ILayer, IFeatureLayer, IRasterLayer, IMxDocument etc.).
Tha Add-in tool (new in 10.0) or the traditional custom component tool can both be developed in VB.NET or C# and would include the logic in the HotLinkImage VBA Macro. Add-ins are easier to deploy and for such a simple framework customization would be recommended over a traditional custom component tool. They are also slightly easier to develop.
The following document walks us through creating our first Add-in tool and the link below includes an Add-in tool already developed, called SelectByLineTool.vb (click on the VB.NET tab). In the OnMouseDown sub procedure which gets fired with MouseEventArgs, we can copy some of that logic to help us get a map point of the area which an enduser clicks on the map in order to then use that point to query the feature we need to locate programmatically that will provide us with the hyperlink string. Or you may prefer to do that in the OnMouseUp instead.
We've found that creating layer files of all of our TIF allows them to be brought into the map when the hyperlink setting is set to document with a field that holds the path of the layer. In a new map, it seems that this method works fine. However, in an existing map with mutiple layers already, the only way I've found it will work where: A. There are no overlapping Polygons (this is no good for us, we have several different images sometimes for the same area) B. If, when the layer chooser window comes up after clicking on overlapping polygons, If I click Jump, and then Close very quickly, the image gets added to the map, but not if I just click Jump. I thought this was sort of odd.
I've been trying to work through what someone else posted in reply to the same question I posted in the Python forum, but I'm having some trouble getting the last part of the function to run. As well as figure out a way, like you said, to emulate the functionality for the hyperlink script in vb.net, but I didn't realize I couldn't do any geoprocessing calls in that.
I hope you can find some time to port that to an add-in, I would super appreciate it, I'd owe you a drink at the UC.
Either way, thank you for replying, this is a problem we've been working on for a long time now.
Ross Wiseman GIS Technician City of Fayetteville, AR
I will try to create an add-in that does a similar thing. I will be out half of July so not too sure when. Check the Code Gallery where people share custom applications or custom components. It has replaced the ArcScripts webpages.