Dropbox button for any location

Hi,

Here is a vbscript script to access to the Dropbox folder with a custom button.
It works for any location of Dropbox because this script search the Dropbox location in the host.db file:

[code]Option Explicit

Dim CMD, WshShell, fso, ApplicationData, configFile, objReadFile, str64, strPath
CMD = """C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"" /acmd Go "

Set WshShell = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
ApplicationData = WshShell.ExpandEnvironmentStrings("%APPDATA%")

configFile = ApplicationData & "\Dropbox\host.db"

If fso.FileExists( configFile ) Then
Set objReadFile = fso.OpenTextFile( configFile, 1)
Do Until objReadFile.AtEndOfStream
str64 = objReadFile.ReadLine
Loop
End If
strPath = Base64Decode(str64)
'MsgBox strPath
CMD = CMD & strPath
WshShell.Run CMD

' 1999 - 2004 Antonin Foller, http://www.motobit.com
Function Base64Decode(ByVal base64String)
Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Dim dataLength, sOut, groupBegin

base64String = Replace(base64String, vbCrLf, "")
base64String = Replace(base64String, vbTab, "")
base64String = Replace(base64String, " ", "")

dataLength = Len(base64String)
If dataLength Mod 4 <> 0 Then
Err.Raise 1, "Base64Decode", "Bad Base64 string."
Exit Function
End If

For groupBegin = 1 To dataLength Step 4
Dim numDataBytes, CharCounter, thisChar, thisData, nGroup, pOut
numDataBytes = 3
nGroup = 0

For CharCounter = 0 To 3
  thisChar = Mid(base64String, groupBegin + CharCounter, 1)

  If thisChar = "=" Then
    numDataBytes = numDataBytes - 1
    thisData = 0
  Else
    thisData = InStr(1, Base64, thisChar, vbBinaryCompare) - 1
  End If
  If thisData = -1 Then
    Err.Raise 2, "Base64Decode", "Bad character In Base64 string."
    Exit Function
  End If

  nGroup = 64 * nGroup + thisData
Next

nGroup = Hex(nGroup)

nGroup = String(6 - Len(nGroup), "0") & nGroup

pOut = Chr(CByte("&H" & Mid(nGroup, 1, 2))) + _
  Chr(CByte("&H" & Mid(nGroup, 3, 2))) + _
  Chr(CByte("&H" & Mid(nGroup, 5, 2)))

sOut = sOut & Left(pOut, numDataBytes)

Next

Base64Decode = sOut
End Function[/code]
If think it can be better because the location of Directory opus executable I wrote can be in another folder (like in Windows 64 bits I guess)

The code for the button is only:

C:\YourScriptsFolder\ThisScriptFile.vbs

If you want a pretty icon for this button, you can find some here :wink: