Getting started with deadDrop

Here's how to get started with ScriptDB as a dead drop. For this example, I'll be instrumenting Integrating Excel with Maps and Earth to use a dead drop to pass data between Excel and the generated app. You should familiarize yourself with A VBA API for scriptDB, since we'll be using that API.

Getting the code

You'll need various modules and classes in your workbook. You can incorporate these into your own workbook automatically (How to update modules automatically in VBA) using 

Public Function gtDeadDropLoad()

' scriptdbcom & deaddrop
  gtDoit "8767201", True
' parsecom - may want to use instead
  gtDoit "7663169", True

End Function

but for playing around with this example, just download googleMapping.xlsm from Downloads. The required libraries are also in cDataSet.xlsm.

Setting up for access to scriptDB from Excel.

To be able to access the correct scriptDB from Excel, various parameters and keys are needed. This only needs to be done once per user/PC combination. Since you may not want to share these, I recommend a separate workbook, but the public scriptDB credentials we are going to use for deadDrop playing are in googleMapping.xlsm, and look like this. You should execute this on the PC you are going to use to store the credentials in the PC registry under an entry called "messages". In future, we'll use that entry name to get handles to the scriptDb deadDrop.

Private Sub firstTimescriptdbMessages()
    Dim scriptdbCom As cScriptDbCom
    Set scriptdbCom = New cScriptDbCom
    With scriptdbCom.init(, _
                "messages", _
                , _
                "messagesKey", _
                "xliberation", _
                False, _
                "scriptDBMessages", _
                False, _
    End With
End Sub

Setting up for access to scriptDB from your co-operating webapp.

Since we are going to generate a web app from Excel, that web app will also need to know how to access the scriptDb instance you are planning to use. Just as for the PC, this needs to be run only once. It uses local web storage if it can, or if your browser is old it might use cookies instead. You need to run this in the same way you will be executing the webapp - this because the cookie storage is domain specifc. The normal way for googleMapping.xlsm is to execute it locally from the PC, however some people move it to a web site. 
<!DOCTYPE html>
<meta charset="utf-8" />
<title>deaddroptest -</title>

<link rel="stylesheet" type="text/css" href="">
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
(function () {
  google.load("jquery", "1");
  google.setOnLoadCallback(function() {
    firstTimeMessages ();
    function renderScriptDb(control,id) {
Register this domain/computer for deaddrop messages
<div id="register">

For convenience, I've included this code in the template section of googleMapping.xlsm, and you can generate and execute it like this. If you are planning to execute from a web site rather than locally, then move the generated file there and execute it. 

Public Sub registerDeadDrop()
    Dim ds As cDataSet, cc As cCell, fName As String, sf As String
    Set ds = New cDataSet

    With ds.populateData(wholeSheet(cGeoCodingParameters), , , True, cCustomCode)
        Set cc = .cell("local register", "code")
        If Not cc Is Nothing Then
            sf = cc.toString & vbCrLf
            MsgBox ("could not find how to register local for deaddrop")
            Exit Sub
        End If
        fName = "localDeadDropRegister.html"

        If openNewHtml(fName, sf) Then
            OpenUrl fName
        End If
    End With
End Sub

That's the preparation over. 

If you decide to create your own scriptDB environment eventually, you'll need to create your own version of firstTimeMessages() for both VBA (shown earlier) and JavaScript (below). 

You can get me on Google plus, Twitter or this forum. See ScriptDB as a dead drop for more on this
For help and more information join our forumfollow the blogfollow me on twitter