Results 1 to 8 of 8

Thread: batch lisp runner

  1. #1
    100 Club
    Join Date
    2012-11
    Posts
    104

    Default batch lisp runner

    Hey Guys

    Ive got a titblock updater lisp that works well but i would like make an additional lisp that prompts the user with a dialog box of the current directory and selects MULTIPLE files and then opens each files runs the lisp, saves and closes the file. ive had a bit of a go at this but aparently autolisp doesnt allow you to select multiple files with getfiled.
    anyone know a way around this?

    Cheers

  2. #2
    Forum Manager, Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    4,777

    Default Re: batch lisp runner

    Download ScriptPro from here. It does exactly that. Select a bunch of files, select a script, run. If you already have a lsp, you just need to save it as a script.
    Last edited by Ed Jobe; 2012-12-11 at 02:54 PM.
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2012-11
    Posts
    14

    Default Re: batch lisp runner

    Lee Mack has some great routines that can be easily integrated into your own. Try looking at the various VL- functions if you're set on having a lisp program to do it, otherwise, script pro is the way to go.

  4. #4
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,401

    Default Re: batch lisp runner

    Quote Originally Posted by matthew.e.mortimer342462 View Post
    Ive got a titblock updater lisp that works well but i would like make an additional lisp that prompts the user with a dialog box of the current directory and selects MULTIPLE files and then opens each files runs the lisp, saves and closes the file. ive had a bit of a go at this but aparently autolisp doesnt allow you to select multiple files with getfiled.
    anyone know a way around this?
    I do something similar in this post, albeit in my case I'm performing specific tasks for Civil 3D, you *should* be able to pull what you need from the code in my post... Specifically, the code that pertains to interfacing with the Shell.Application, and ObjectDBX Objects.
    "Potential has a shelf life." - Margaret Atwood

  5. #5
    Past Vice President peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu Hawaii
    Posts
    574

    Default Re: batch lisp runner

    Creation of a vb.net multiselect file dialog that can be exposed to lisp is straightforward.

    I am partial to using .net to expanding the power of lisp...

    Although you can't beat LISP for fast coding.

    P=

    Code:
    Imports Autodesk.AutoCAD
    Imports Autodesk.AutoCAD.Runtime
    Imports Autodesk.AutoCAD.EditorInput
    Imports Autodesk.AutoCAD.DatabaseServices
    Imports Autodesk.AutoCAD.Geometry
    Imports Autodesk.AutoCAD.Colors
    Imports Autodesk.AutoCAD.ApplicationServices
    Imports Autodesk.AutoCAD.Windows
    Imports System.Windows.Forms
    Imports System.Runtime.InteropServices 'for DllImport()
    Imports System.Text ' for StringBuilder
    
    Public Class VB2LISPClass
    
    ' (vbvl:MultipleOpenFileDialog "Title" "c:\\acad" "312vg.dwg" "(*.dwg)|*.dwg|All files (*.*)|*.*")
    
        <LispFunction("vbvl:MultipleOpenFileDialog")> _
            Public Function dotNetGetFile1(ByVal rbfArguments As ResultBuffer)
            Dim arrResult() As String
            Dim objResult As ResultBuffer = rbfArguments
            Dim objFileDialog As New System.Windows.Forms.OpenFileDialog
            Dim tpvReturn As TypedValue = New TypedValue(LispDataType.Nil, -1)
            Try
                Dim arrArguments As TypedValue() = rbfArguments.AsArray()
                ' Get the ObjectId passed in from LISP function
                If arrArguments.Length >= 3 And _
                    arrArguments(0).TypeCode = LispDataType.Text And _
                    arrArguments(1).TypeCode = LispDataType.Text And _
                    arrArguments(2).TypeCode = LispDataType.Text Then
                    With objFileDialog
                        .Title = arrArguments(0).Value.ToString
                        .InitialDirectory = arrArguments(1).Value.ToString
                        .FileName = arrArguments(2).Value.ToString
                        If arrArguments.Length > 3 Then
                            If arrArguments(3).Value.ToString <> "" Then
                                MsgBox(arrArguments(3).Value.ToString)
                                .FilterIndex = 1
                                .Filter = arrArguments(3).Value.ToString
                            End If
                        End If
                        .Multiselect = True
                        If .ShowDialog() = DialogResult.OK Then
                            ReDim arrResult(.FileNames.Length - 1)
                            arrResult = .FileNames
                            objResult = New ResultBuffer(New TypedValue(CInt(5005), arrResult(0).ToString))
                            For intItem2 As Integer = 1 To arrResult.Length - 1
                                objResult.Add(New TypedValue(CInt(5005), arrResult(intItem2).ToString))
                            Next intItem2
                            Return objResult
                        Else
                            Return tpvReturn
                        End If
                    End With
                End If
            Catch ex As System.Exception
                System.Diagnostics.Debug.Write(ex.ToString())
                Return tpvReturn
            End Try
            Return tpvReturn
        End Function
    End Class
    AUGI Volunteer

  6. #6
    100 Club
    Join Date
    2012-11
    Posts
    104

    Default Re: batch lisp runner

    Hey mate
    I am still new to coding, ive only taught myself lisp in the last couple of months and havnt so much as seen vb code before this.
    I dont supposed you would mind putting in a few descriptors to help me descipher this?

  7. #7
    Past Vice President peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu Hawaii
    Posts
    574

    Default Re: batch lisp runner

    see www.vbcad.com and read Jerry's book to learn .net

    I can compile this and post the dll so you can play with it.

    Let me know if you would like it.

    Als you can download the visualbasic 2010 express version online for free.

    You load it with netload command

    P=
    AUGI Volunteer

  8. #8
    100 Club
    Join Date
    2012-11
    Posts
    104

    Default Re: batch lisp runner

    Cheers mate, ill check it out when i get a bit of free time.

Similar Threads

  1. Replies: 4
    Last Post: 2008-12-03, 05:39 AM
  2. Batch lisp Runner
    By balubharadwaj in forum AutoCAD Tips & Tricks
    Replies: 3
    Last Post: 2008-07-03, 02:50 PM
  3. Runner Channels
    By troberts in forum Revit Structure - Families
    Replies: 1
    Last Post: 2008-03-12, 01:06 PM
  4. A LISP routine for runing a batch file ?
    By stephen.coff in forum AutoLISP
    Replies: 3
    Last Post: 2006-09-07, 02:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •