scriptpro.lsp missing!

Discussion in 'AutoCAD' started by buttons129, Feb 8, 2005.

  1. buttons129

    buttons129 Guest

    having a few problems running scriptpro. this is the message i get. have searched for the file `scriptpro.lsp' on my PC and the AutoCAD CD but no luck. can anyone help

    Starting AutoCAD...
    Dialog appeared - [[ "AutoCAD Message" ]] ' An internal AutoLISP error has occured. The command you were using may not have worked sucessfully. The technical error is a Code #93 which means in this instance - LOAD failed: "scriptpro.lsp".' [OK]
     
    buttons129, Feb 8, 2005
    #1
  2. buttons129

    BillZ Guest

    BillZ, Feb 8, 2005
    #2
  3. buttons129

    buttons129 Guest

    Why would it say

    Code #93 which means in this instance - LOAD failed: "scriptpro.lsp".' [OK]

    this has come from the sriptpro.exe i presume
     
    buttons129, Feb 8, 2005
    #3
  4. buttons129

    GoodJuJu Guest

    Scriptpro.lsp is located in C:\Program Files\AutoCAD 200*\Express
    I will copy and paste the contents of this into the next 'reply'. I usually find however that having at least one file missing is the start of bigger problems. Hopefully this will work for you. Do you have an 'Express' folder..... could be the issue?
     
    GoodJuJu, Feb 9, 2005
    #4
  5. buttons129

    GoodJuJu Guest

    ; MODULE_ID SCRIPTPRO_LSP_
    ;

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;
    ;The main program to run from AutoCAD
    ;
    (defun c:ScriptPro ( / ans fna def exe fun)
    (setq fun (acet-sp-regfun "c:ScriptPro"))

    (acet-error-init (list nil nil))
    (if (setq exe (acet-sp-findfile "scriptpro.exe"))
    (progn
    (if (not (equal (substr exe 1 1) (chr 34)))
    (setq exe (strcat (chr 34) exe))
    )
    (if (not (equal (substr exe (strlen exe)) (chr 34)))
    (setq exe (strcat exe (chr 34)))
    )
    (startapp exe)
    );progn then
    );if
    (acet-error-restore)
    );defun c:ScriptPro


    (defun c:spScript ( / fna )
    (acet-error-init nil)
    (if (setq fna (acet-ui-getfile ;|SCRIPTPRO_LSP_1|;"Select a script file to run"
    (strcat (getvar "dwgprefix") (acet-filename-ext-remove (getvar "dwgname")) ".scr")
    "SCR"
    0
    )
    );setq
    (acet-script-run fna nil)
    );if
    (acet-error-restore)
    );defun c:spScript

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-catch-on ( / vbapp fun)
    (setq fun (acet-sp-regfun "acet-sp-catch-on"))

    (if (setq vbapp (acet-sp-catch-dll))
    (acet-sp-catch-react-on)
    (acet-sp-princ fun ;|SCRIPTPRO_LSP_2|;"Unable to obtain spCatch.dll object.")
    );if

    (princ)
    );defun acet-sp-catch-on

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;acet-sp-catch-off -turn ScriptPro watch off
    ;
    (defun acet-sp-catch-off ( / fun )
    (setq fun (acet-sp-regfun "acet-sp-catch-off"))

    (acet-sp-catch-react-off) ;;turn reactors off.

    (princ)
    );defun acet-sp-catch-off


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-script-run ( scr runflag / fun tmp fh a lst n )
    (setq fun (acet-sp-regfun "acet-script-run"))

    (setq scr (strcase (acet-sp-scr-name-format scr))
    fh (acet-file-open scr "r")
    );setq
    (while (setq a (read-line fh));setq
    (setq lst (cons a lst));setq
    );while
    (close fh)
    (setq lst (reverse lst))

    (princ ;|SCRIPTPRO_LSP_3|;"\nPre-processing script...")
    (princ)
    (setq tmp (strcase (vlax-invoke (acet-sp-catch-dll) 'TmpScrFilename))
    lst (acet-sp-process-calls scr lst (list tmp))
    );setq
    (setq fh (acet-file-open tmp "w")
    lst (cadr lst)
    );setq
    (setq n 0);setq
    (repeat (length lst)
    (setq a (nth n lst));setq
    (write-line a fh)
    (setq n (+ n 1));setq
    );repeat
    (if runflag
    (write-line "scr-quit" fh) ;the this is a project run
    );if
    (close fh)
    (princ ;|SCRIPTPRO_LSP_4|;"Done")
    (princ)

    (if runflag
    (acet-sp-catch-on)
    );if
    (command "_.script" tmp)

    (princ)
    );defun acet-script-run

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-str-filename-subst ( a / x y z )
    (setq x (getvar "dwgprefix") ;the path
    y (getvar "dwgname")
    z (acet-filename-extension y) ;the extension
    y (acet-filename-ext-remove y) ;the base name
    a (acet-str-replace "<acet:cFolderName>" x a T)
    a (acet-str-replace "<acet:cBaseName>" y a T)
    a (acet-str-replace "<acet:cExtension>" z a T)
    a (acet-str-replace "<acet:cFileName>" (strcat y z) a T) ;same as dwgname
    a (acet-str-replace "<acet:cFullFileName>" (strcat x y z) a T) ;full file name
    );setq
    a
    );defun acet-str-filename-subst

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-process-calls ( scr lst fnalst / fun fna2 fh2 a b lst2 lst3 n flag )
    (setq fun (acet-sp-regfun "acet-sp-process-calls"))

    (setq n 0);setq
    (repeat (length lst)
    (setq a (nth n lst)
    a (acet-str-filename-subst a)
    a (acet-str-replace scr (car lst) a T)
    );setq
    (if (equal "CALL " (strcase (substr a 1 5)))
    (progn
    (setq fna2 (substr a 6)
    fna2 (acet-str-replace (chr 34) "" fna2) ;get rid of double quotes
    fna2 (strcase fna2)
    fna2 (acet-sp-scr-name-format fna2)
    );setq
    (setq flag 99);setq
    (if (member fna2 fnalst)
    (progn
    (setq lst2 (list (strcat "._script "
    (chr 34) fna2 (chr 34)
    );strcat
    );list
    );setq
    );progn then replace the call with the script command to avoid endless recursion
    (progn
    (setq fh2 (acet-file-open fna2 "r")
    lst2 nil
    );setq
    (if (not fh2)
    (progn
    (acet-sp-princ fun ;|SCRIPTPRO_LSP_5|;"Could not open file for read.")
    (acet-print fna2)
    (exit)
    );progn then
    );if
    (while (setq b (read-line fh2));setq
    (setq lst2 (cons b lst2))
    );while
    (close fh2)
    (setq lst2 (reverse lst2))
    (setq lst2 (cadr (acet-sp-process-calls scr
    lst2
    (append fnalst (list fna2))
    )
    )
    );setq
    );progn else
    );if
    );progn then it's a call line
    (setq lst2 (list a));setq else
    );if
    (setq lst3 (append lst3 lst2));setq
    (setq n (+ n 1));setq
    );repeat

    (list flag lst3)
    );defun acet-sp-process-calls


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;Begin VB app functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;acet-sp-catch-dll -
    ;Low-level function for getting the AS_WATCH.DLL object.
    ;Loads the dll into memory and sets a global to the object id.
    ;returns the value of the global acet:sp-dll
    ;NOTE: Do not directly call this funciton.
    ; Use acet-sp-watch-access to get the object instead.
    ;
    (defun acet-sp-catch-dll ( / acadapp holdit fun)
    (setq fun (acet-sp-regfun "acet-sp-catch-dll"))
    ;;;;do some error handling
    (setq holdit *error*)
    (defun *error* ( a )
    ;(print "attempting to handle an error in acet-sp-catch-dll")
    (princ a)
    (setq acet:sp-dll nil)
    (setq *error* holdit)
    (acet-sp-catch-dll)
    );defun

    (if (and (or (not acet:sp-dll)
    (not (vlax-invoke acet:sp-dll 'CurrentProcID)) ;this is where an error might occur
    );or
    (setq acadApp (vlax-get-acad-object)) ; get the main AutoCAD application object
    );and
    (progn
    (if (not acet:sp-dll)
    ;(vlr-editor-reactor nil '(:)vlr-databaseToBeDestroyed . acet-gc)))
    (vlr-dwg-reactor nil '(:)vlr-beginClose . acet-gc)))
    );if
    (setq acet:sp-dll (vlax-invoke
    acadApp
    'GetInterfaceObject
    "spCatch_dll.spCatch_dll_cls" ;The format is "projectname"."classname"
    );vlax-invoke
    );setq
    );progn then
    );if
    (if (not acet:sp-dll)
    (acet-sp-princ fun ;|SCRIPTPRO_LSP_2|;"Unable to obtain spCatch.dll object.")
    );if
    (setq *error* holdit)

    acet:sp-dll
    );defun acet-sp-catch-dll

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;used to ensure that the class terminate function within spcatch.dll gets fired on AutoCAD quit.
    (defun acet-gc ( a b )
    (acet-sp-react-all-off)
    );defun acet-gc

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;BEGIN Reactor setup/tear-down and callback functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;initialize/Turn Reactors on
    ;
    (defun acet-sp-catch-react-on ( / fun)
    (setq fun (acet-sp-regfun "acet-sp-catch-react-on"))

    (acet-sp-event "log" (getvar "logfilename")) ;the first message to send is the log file name.
    (acet-sp-event "open" (acet-sp-dwgname)) ;the second message to send is "open".

    (setq #acet-sp-catch-react-off nil)
    (acet-editor-reactor-add ':)vlr-unknowncommand . acet-sp-unknowncmd))
    (acet-editor-reactor-add ':)vlr-commandwillstart . acet-sp-begincmd))
    (acet-editor-reactor-add ':)vlr-commandfailed . acet-sp-failedcmd))
    (acet-editor-reactor-add ':)vlr-commandcancelled . acet-sp-cancelledcmd))
    (acet-editor-reactor-add ':)vlr-commandended . acet-sp-endcmd))
    (acet-editor-reactor-add ':)vlr-lispwillstart . acet-sp-beginlsp))
    (acet-editor-reactor-add ':)vlr-lispcancelled . acet-sp-cancelledlsp))
    (acet-editor-reactor-add ':)vlr-lispended . acet-sp-endlsp))

    (acet-editor-reactor-add ':)vlr-savecomplete . acet-sp-savecomplete))

    );defun acet-sp-catch-react-on

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Remove active Reactors
    ;
    (defun acet-sp-catch-react-off ( / r vbapp fun)
    (setq fun (acet-sp-regfun "acet-sp-catch-react-off"))
    (setq #acet-sp-catch-react-off T) ;set a flag that tells each callback function to remove
    ;the reactor the next time it is called.
    (acet-sp-event "done" (acet-sp-dwgname)) ;the last message to send is done.
    (setq acet:sp-dll nil) ;set this nil here so that any acet-sp-event calls that follow
    ;will not actually post any messages and cause the catch.exe to be re-invoked
    (gc)(gc)
    );defun acet-sp-catch-react-off

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-react-all-off ()

    (acet-sp-catch-react-off)

    (acet-sp-unknowncmd nil nil)
    (acet-sp-failedcmd nil nil)
    (acet-sp-cancelledcmd nil nil)
    (acet-sp-cancelledlsp nil nil)
    (acet-sp-begincmd nil nil)
    (acet-sp-endcmd nil nil)
    ;(acet-sp-beginlsp nil nil)
    (acet-sp-endlsp nil nil)
    (acet-sp-savecomplete nil nil)

    );defun acet-sp-react-all-off

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-unknowncmd ( a b / r fun )
    (setq fun (acet-sp-regfun "acet-sp-unknowncmd"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-unknowncommand . acet-sp-unknowncmd))
    (progn
    (if (not (car b)) (setq b (list "")))
    (acet-sp-event "*error*" (acet-str-format ;|SCRIPTPRO_LSP_6|;"Unknown Command %1" (car b)))
    );progn
    );if
    );defun acet-sp-unknowncmd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-failedcmd ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-failedcmd"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-commandfailed . acet-sp-failedcmd))
    (progn
    (if (not (car b)) (setq b (list "")))
    (acet-sp-event "*error*" (acet-str-format ;|SCRIPTPRO_LSP_7|;"Failed Command %1" (car b)))
    );progn
    );if
    );defun acet-sp-failedcmd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-cancelledcmd ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-cancelledcmd"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-commandcancelled . acet-sp-cancelledcmd))
    (progn
    (if (not (car b)) (setq b (list "")))
    (acet-sp-event "*error*" (acet-str-format ;|SCRIPTPRO_LSP_8|;"Cancelled Command %1" (car b)))
    );progn
    );if
    );defun acet-sp-cancelledcmd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-cancelledlsp ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-cancelledlsp"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-lispcancelled . acet-sp-cancelledlsp))
    (progn
    (if (not (car b)) (setq b (list "")))
    (acet-sp-event "*error*" (acet-str-format ;|SCRIPTPRO_LSP_9|;"Cancelled Lisp %1" (car b)))
    );progn else
    );if
    );defun acet-sp-cancelledlsp
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-begincmd ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-begincmd"))
    (if (and (car b)
    (acet-str-equal (car b) "QUIT")
    );and
    (acet-sp-react-all-off)
    );if
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-commandwillstart . acet-sp-begincmd))
    (acet-sp-event "begincmd" ;|SCRIPTPRO_LSP_10|;"Begin Command")
    );if
    );defun acet-sp-begincmd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-endcmd ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-endcmd"))
    (if (and (car b)
    (acet-str-equal (car b) "QUIT")
    );and
    (acet-sp-react-all-off)
    );if
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-commandended . acet-sp-endcmd))
    (acet-sp-event "endcmd" ;|SCRIPTPRO_LSP_11|;"Command Ended")
    );if
    );defun acet-sp-endcmd
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-beginlsp ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-beginlsp"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-lispwillstart . acet-sp-beginlsp))
    (acet-sp-event "beginlsp" ;|SCRIPTPRO_LSP_12|;"Begin LISP")
    );if
    );defun acet-sp-beginlsp
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-endlsp ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-endlsp"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-lispended . acet-sp-endlsp))
    (acet-sp-event "endlsp" ;|SCRIPTPRO_LSP_13|;"LISP Ended")
    );if
    );defun acet-sp-endlsp

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-savecomplete ( a b / r fun)
    (setq fun (acet-sp-regfun "acet-sp-savecomplete"))
    (if #acet-sp-catch-react-off
    (acet-reactor-remove ':)vlr-savecomplete . acet-sp-savecomplete))
    (acet-sp-event "log" (getvar "logfilename"))
    );if
    );defun acet-sp-savecomplete

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;spcatch.exe - communication function
    ;The is the general event pass-through function.
    ;Each reactor callback function calls this function.
    ;
    (defun acet-sp-event ( msgtype msg / fun vbApp )
    (setq fun (acet-sp-regfun "acet-sp-event"))
    (if acet:sp-dll ;;;(setq vbapp (acet-sp-catch-dll))
    (vlax-invoke acet:sp-dll 'PostEvent msgtype msg)
    (gc)
    );if
    );defun acet-sp-event
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;END Reactor setup/tear-down and callback functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;BEGIN short-cut script commands;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;SCR-OPEN "SCRipt-OPEN"
    ;This will open a specified drawing.
    ;The only prompt is for a filename.
    ;*IMPORTANT NOTE*: The current drawing will not be
    ;saved, so save it first if you need to.
    ;Also the specified drawing file must (of course) exist.
    ;
    ;Additional NOTES:
    ;Read-only files can be opened.
    ;Drawings that require recovery can also be opened using
    ;this command provided that AutoCAD can successfully recover
    ;the file.
    ;
    ;
    (defun c:scr-open ( / fna fna2 n a b fun)
    (setq fun (acet-sp-regfun "c:scr-open"))


    (acet-error-init (list '("cmdecho" 0
    "expert" 0
    )
    nil
    )
    );acet-error-init

    ;;;This stops enter to continue prompts such as the one
    ;;;that occurs after a drawing recovery.
    (if (not (equal 2 (logand 2 (getvar "qaflags"))))
    (setvar "qaflags" (+ (getvar "qaflags") 2))
    );if

    ;;;This stops certain dialogs from appearing.
    (if (not (equal 4 (logand 4 (getvar "qaflags"))))
    (setvar "qaflags" (+ (getvar "qaflags") 4))
    );if

    (setq fna (getstring T ;|SCRIPTPRO_LSP_14|;"\nEnter name of drawing: ")
    fna (acet-str-filename-subst fna)
    fna2 (acet-sp-find-dwg-file fna)
    );setq
    (setq fna fna2)

    (setvar "cmdecho" 1)

    (command "_.open")
    (if (not (equal 0 (getvar "dbmod")))
    (command "_y")
    );if
    (command fna)
    ;Attempt to Bulldose your way into the drawing.

    (setq n 0)
    (while (and (< n 4)
    (wcmatch (getvar "cmdnames") "*OPEN*") ;while open is still active
    );and
    (cond
    ((wcmatch (getvar "lastprompt") "*incompatible version*");wcmatch
    (setq n 99)
    )
    ((wcmatch (getvar "lastprompt") "*Drawing file is not valid*");wcmatch
    (setq n 99)
    )
    (T
    (command "")
    )
    );cond close
    (setq n (+ n 1));setq
    );while
    (acet-cmd-exit)
    (acet-error-restore)
    );defun c:scr-open

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:scr-saveas-r13 ( / fun )
    (setq fun (acet-sp-regfun "c:scr-saveas-r13"))
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_15|;"\nSave R13 drawing as"))
    (acet-scr-saveas (list "_r13" a))
    );if
    (acet-error-restore)
    );defun c:scr-saveas-r13

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;SCR-SAVEAS-R14
    ;This will save the current drawing as R14 to the specified name.
    ;NOTES: Issues one single prompt. The default is always the current dwg name with
    ; fully qualified path.
    ; No OVERWRITE WARNING will be given.
    ;
    ;
    (defun c:scr-saveas-r14 ( / fun )
    (setq fun (acet-sp-regfun "c:scr-saveas-r14"))
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_16|;"\nSave R14 drawing as"))
    (acet-scr-saveas (list "_r14" a))
    );if
    (acet-error-restore)
    );defun c:scr-saveas-r14

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:scr-saveas-2000 ( / fun)
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_17|;"\nSave 2000 drawing as"))
    (acet-scr-saveas (list "_2000" a))
    );if
    (acet-error-restore)
    );defun c:scr-saveas-2000

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:scr-dxfout-r12 ( / fun)
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_18|;"\nSave R12 drawing as"))
    (acet-scr-saveas (list "_dxf" "_version" "_r12" "16" a))
    );if
    (acet-error-restore)
    );defun c:scr-dxfout-r12

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:scr-dxfout-r13 ( / fun)
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_19|;"\nSave R13 dxf as"))
    (acet-scr-saveas (list "_dxf" "_version" "_r13" "16" a))
    );if
    (acet-error-restore)
    );defun c:scr-dxfout-r13

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:scr-dxfout-r14 ( / fun)
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_20|;"\nSave R14 dxf as"))
    (acet-scr-saveas (list "_dxf" "_version" "_r14" "16" a))
    );if
    (acet-error-restore)
    );defun c:scr-dxfout-r14

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:scr-dxfout-2000 ( / fun)
    (acet-error-init (list '("cmdecho" 0
    "filedia" 0
    )
    nil
    )
    );acet-error-init
    (if (setq a (getstring T ;|SCRIPTPRO_LSP_21|;"\nSave 2000 dxf as"))
    (acet-scr-saveas (list "_dxf" "_version" "_2000" "16" a))
    );if
    (acet-error-restore)
    );defun c:scr-dxfout-2000

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-scr-saveas ( lst / a lst n fun )

    (if lst
    (progn
    (setq a (last lst)
    a (acet-str-lr-trim "\" \t" a)
    a (acet-str-filename-subst a)
    a (acet-filename-ext-remove a)
    lst (reverse (cdr (reverse lst)))
    lst (append lst
    (list a) ;format the name to replace key strings
    )
    );setq
    (command "_.saveas")
    (setq n 0)
    (repeat (length lst)
    (command (nth n lst))
    (setq n (+ n 1));setq
    );repeat
    (while (wcmatch (getvar "cmdnames") "*SAVEAS")
    (command "_Y")
    );while
    );progn then
    );if
    );defun acet-scr-saveas

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Starts a new drawing.
    ;No prompts
    ;IMPORTANT - current drawing will NOT be saved
    (defun c:scr-new ( / fun)
    (setq fun (acet-sp-regfun "c:scr-new"))
    (acet-error-init (list '("cmdecho" 0
    "expert" 0
    )
    nil
    )
    );acet-error-init

    (command "_.new")
    (if (not (equal (getvar "dbmod") 0))
    (command "_y")
    );if
    (while (wcmatch (getvar "cmdnames") "*NEW*")
    (command "")
    );while
    (acet-error-restore)
    );defun c:scr-new

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Tries to Quit AutoCAD
    ;No prompts
    ;IMPORTANT - current drawing will NOT be saved
    (defun c:scr-quit ( / )

    (acet-sp-react-all-off)

    (if (not (equal 0 (getvar "dbmod")))
    (progn
    (while (not (wcmatch (getvar "cmdnames") "*QUIT*"))
    (command "_.quit")
    );while
    (while (wcmatch (getvar "cmdnames") "*QUIT*")
    (command "_y")
    );while
    );progn then
    (command "_.quit")
    );if
    );defun c:scr-quit

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;call this is quit fails for some reason
    (defun acet-sp-isaidquit ()
    (vlax-invoke (acet-sp-catch-dll) 'LaterDude) ;if this gets a chance to execute then AutoCAD _will_ fall
    )


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-find-dwg-file ( fna / lst n fna2 fun)
    (setq fun (acet-sp-regfun "acet-sp-find-dwg-file"))
    (cond
    ((or (not fna)
    (equal fna "")
    )
    (setq fna2 nil)
    );cond #1
    ((and (not (setq fna2 (acet-sp-findfile fna)))
    (equal "" (acet-filename-extension fna))
    );and
    (setq lst (list ".dwg" ".dwt" ".dxf")) ;then try to find the file using several valid extensions
    (setq n 0)
    (while (and (< n (length lst))
    (not fna2)
    );and
    (setq fna2 (strcat fna (nth n lst))
    fna2 (acet-sp-findfile fna2)
    );setq
    (setq n (+ n 1));setq
    );while
    );cond #2
    );cond close
    fna2
    );defun acet-sp-find-dwg-file

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;END OF short-hand version of commands for use in scripts;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;Debug/utility functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun c:debug ()
    (if acet:as-debug
    (progn
    (setq acet:as-debug nil)
    (princ "debug OFF")
    );progn then
    (progn
    (setq acet:as-debug T)
    (princ "debug ON")
    );progn else
    );if
    );defun c:debug

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-princ ( fun msg )
    (if acet:as-debug
    (progn
    (if (not fun) (setq fun acet:-fun))
    (if (not fun) (setq fun ""))
    (princ (strcat "\n" fun ": " msg))
    );progn then
    (princ (strcat "\n" msg))
    );if
    );defun acet-sp-princ

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-regfun ( fun )
    (setq acet:-fun fun)
    (while (> (length acet:fun-list) 5)
    (setq acet:fun-list (cdr acet:fun-list))
    );while
    (setq acet:fun-list (append acet:fun-list (list fun)))
    fun
    );defun acet-sp-regfun

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-print ( variable )
    (print variable)
    (print (eval variable))
    (princ)
    );defun acet-print

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;acet-sp-findfile
    ;Takes a file name and looks for it.
    ;Returns full path (unc if possible) on success or nil on failure.
    ;Also prints an error message to command line on failure.
    ;
    (defun acet-sp-findfile ( fna / a)
    (if (not (setq a (findfile fna)))
    (acet-sp-princ (acet-str-format ;|SCRIPTPRO_LSP_22|;"File not found: %1" fna))
    );if
    a
    );defun acet-sp-findfile

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Takes a file name and validates it.
    ;Returns the file name on success and nil on failure
    ;If it is not cool then an error messgae is printed to the command line.
    ;
    (defun acet-sp-filename-valid ( fna / )
    (if (not (acet-filename-valid fna))
    (progn
    (acet-sp-princ nil ;|SCRIPTPRO_LSP_23|;"Invalid filename name.") ;'@localize
    (acet-sp-print 'fna)
    );progn then
    );if
    fna
    );defun acet-sp-filename-valid


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Returns full name of current dwg in UNC if possible.
    (defun acet-sp-dwgname ( / fna)
    (setq fna (acet-full-dwgname));setq
    fna
    );defun acet-sp-dwgname

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun acet-sp-scr-name-format ( fna / a fun )
    (setq fun (acet-sp-regfun "acet-sp-scr-name-format"))

    (if (and fna
    (equal (type fna) 'STR)
    (setq fna (strcase fna))
    (setq fna (acet-str-replace "\t" " " fna))
    (setq fna (acet-str-replace "/" "\\" fna))
    (setq fna (acet-str-space-trim fna));setq
    (not (equal ".SCR"
    (substr fna (max 1 (- (strlen fna) 3)))
    );equal
    );not
    );and
    (setq fna (strcat fna ".SCR"));setq then
    );if

    fna
    );defun acet-sp-scr-name-format

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;END Debug/utility functions;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


    (if (not acet-error-init)
    (load "acetutil.fas" ;|SCRIPTPRO_LSP_24|;"Load of acetutil lisp library failed")
    )
    (if acet-error-init
    (acet-arxload-or-bust "acetutil.arx")
    )
    (princ)
     
    GoodJuJu, Feb 9, 2005
    #5
  6. buttons129

    buttons129 Guest

    thanks for that. i will give it a try and see how i get on. its a shame you cant download scriptpro.lsp form Autodesk.
    i have downloaded the migration tools but it wasn't in there either
     
    buttons129, Feb 9, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.