Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - heifler

#1
What is the code to use a Windows OS Shell command to execute a script?
#2
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">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
#3
newLISP newS / How to Call scripts
August 09, 2009, 05:51:12 PM
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">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