CurDir function in Hyperlink VBScript?

511
3
11-09-2011 05:26 AM
PaulDownie
New Contributor II
Hi,

I hope someone might be able to help me out with an issue I have with a Hyperlink VBScript. Prior to version 10 I was using a Visual Basic macro with the Hyperlink tool to launch an Access database and load a database record associated with the selected point. In that macro I could use the CurDir function to return the directory containing my ArcMap project. This allowed me to distribute the project and database as a package to others to use without the need to alter the script. The CurDir function doesn't return a value in my VBScript. Can anyone tell me if this should or shouldn't be working in VBScript and if it doesn't work in VBScript, suggest some alternative to accomplish the same result?

thanks,

Paul
0 Kudos
3 Replies
JeffBarrette
Esri Regular Contributor
I was curious so I did some searching.  I found:

Dim sCurPath
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")

But this returns the path relative to the ArcGIS install (i.e., the bin directory).  I'm not sure how you would do this with vbScript.

For 10.0, have you tried setting your image names to be relative paths.  For example,  "imageFolder\imageName.tif".  See
http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=Adding_hyperlinks_to_features&anchor=c...

At 10.1 we are going to support Python as a scripting choice and with that you'll have some more options.
0 Kudos
JeffBarrette
Esri Regular Contributor
Again, try the 10.0 suggestion above but if curious, this is what my 10.1 hyperlink python code block looks like:

import arcpy, os, webbrowser
def OpenLink( [HyperLink] )
    mxd = arcpy.mapping.MapDocument("current")
    mxdFolder = os.path.dirname(mxd.filePath)
    fullPath = os.path.join(mxdFolder, [Hyperlink])
    webBrowser.open(fullPath)
    return
0 Kudos
PaulDownie
New Contributor II
Hi Jeff,

Thanks for your suggestions and my apologies for not replying sooner (I thought I had my notification turned on).

I tried specifying a relative path (i.e. leaving off the path for a file in the same directory as the project file) as suggested but with no success. I did note that the help was for 9.3 not 10.0.

Paul
0 Kudos