I code in VBA MS Access. I see great scripts and have loaded newLISP.
I have some VBA code to run newLISP in MS Access database. I have successfully called some basic functions but would like to know how to call a script as seen in http://www.newlisp.org/syntax.cgi?code/twitter.txt
from MS Access.
Here is some code I have so far in a public module:
Option Compare Database
Public Declare Function dllNewlispEval Lib "NewLisp" Alias "newlispEvalStr" (ByVal LExpr As String) As Long
Private Declare Function LoadLibraryA Lib "kernel32" (ByVal s As String) As Long
Private Declare Sub FreeLibrary Lib "kernel32" (ByVal h As Long)
Declare Function lstrLen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long
Declare Function lstrCpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Dim NewlispHandle As Long
Sub Auto_Open()
LoadNewLISP
End Sub
Public Sub LoadNewLISP()
Dim mylib As String
Dim hinst As Long
Dim LibPath As String
mylib = "C:Program Filesnewlispnewlisp.dll"
NewlispHandle = LoadLibraryA(mylib)
If NewlispHandle = 0 Then
MsgBox "Can not find C:Program Filesnewlispnewlisp.dll on this machine."
End If
End Sub
Function NewLisp(LispExpression As String) As Variant
Dim Result As String
Dim ResHandle As Long
Dim ResultCode As Long
ResHandle = dllNewlispEval(LispExpression)
Result = Space$(lstrLen(ByVal ResHandle))
lstrCpy ByVal Result, ByVal ResHandle
NewLisp = Result
End Function
Public Sub Auto_close()
UnloadNewLISP
End Sub
Sub UnloadNewLISP()
FreeLibrary NewlispHandle
End Sub
Public Function CreateLispScript(strUser As String, pw As String) As Variant
Dim strScript As String
strScript = "(+ 8 3)"
CreateLispScript = NewLisp(strScript)
End Function
Private Sub Command0_Click()
Dim str As Variant
Call LoadNewLISP
MsgBox CreateLispScript("TwitterName", "TwitterPassword")
Call Auto_close
End Sub
Bob Heifler
Have you tried:
Open Command Prompt, and type:
newlisp "script"
where script is the name of the script.