QUICK_APPLOAD_v1_01....................................free

Command: QUICKAPPLOAD

This function loads path of an autocad application stored in clipboard. Supported extensions of files: .lsp, .vlx, .fas, .arx, .crx, .dvb, .dbx, .vls, .zelx.

This lisp may by interesting for those people who tend to use other software for writing scripts than Visual Lisp Editor built in Autocad. I personally use Notepad++ where I have keyboard shortcut assigned to a button that runs a simple macro that saves the file and copies to clipboard full file path of the lisp opened in that editor. Then the user can just run QUICKAPPLOAD command and the lisp file will be loaded, without need to going through procedure of loading a lisp file via APPLOAD.

Copying a file path to clipboard can be also done from windows explorer by selecting "Copy File Path" from the context menu, but requires FILE_PATH_UTILITY installed on windows, shown on the video. This useful tool can be downloaded from www.gnostice.com. I use Freecommander with keyboard shortcut assigned to a button.


Code:

;;; =================================================
;;;        QUICKAPPLOAD_v1_01.LSP     
;;;
;;;        Written by Andrzej Kalinowski,     www.autolisps.blogspot.com
;;;        v1.00 - 16.07.2016
;;;        v1.01 - 03.03.2019 - VLS and ZELX added to supported file formats
;;;
;;;        Command: QUICKAPPLOAD - loads path of autocad application stored in clipboard
;;;
;;; =================================================
;
(vl-load-com)
(defun C:QUICKAPPLOAD (/ txtstring txtstringlen ext1 lispname pozslash)
    (setq txtstring (TXTFROMCLIPBOARD) );geting path (string type) from clipboard

    ;-----------------------------------------
    ;checks if text string is a path to autocad app
    ;-----------------------------------------
    (setq
         txtstringlen (strlen txtstring)
         ext1 (strcase (substr txtstring (- txtstringlen 3) txtstringlen) )
    );setq
    
    (if
        (not
            (or
                (= ext1 ".LSP"); Autolisp files
                (= ext1 ".VLX"); Visual Lisp Executables
                (= ext1 ".FAS"); Fast load Autolisp files
                (= ext1 ".ARX"); ObjectARX files
                (= ext1 ".CRX"); Core ObjectARX files
                (= ext1 ".DVB"); VBA files
                (= ext1 ".DBX"); ObjectDBX files
                (= ext1 ".VLS"); ObjectDBX files (ZWCAD analoque format to VLX)
                (= ext1 ".ZELX"); ObjectDBX files (ZWCAD analoque format to FAS)
            );or
        );not
        (progn
            (princ "\nIts not a path to a Autocad App file")
            (exit)
        );progn 
    );if
    ;-----------------------------------------
    ;reading of the name of the lisp
    ;-----------------------------------------
    (setq
            lispname (vl-list->string (reverse (vl-string->list txtstring) )) ;reversing of string
      pozslash (vl-string-position (ascii "\\") lispname);findong of "\\" sign position
      lispname (substr lispname 1 pozslash);cuting name of file from the path
      lispname (vl-list->string (reverse (vl-string->list lispname) ) );reversing of string back
    );setq
    ;-----------------------------------------
    ;loading of the lisp
    ;-----------------------------------------
    (if (load txtstring nil)
        ;(princ (strcat "\nLoaded lisp: " lispname) )
        (princ (strcat "\nLoaded lisp: " lispname "\t\tFile path: " txtstring) )
        (princ (strcat "\n" lispname " Lisp didnt load!!!!!!!!!!!!!!") )
    );if
    (princ)
);defun
;;; =======================================================
;;;                          TXTFROMCLIPBOARD                           
;;; =======================================================
(defun TXTFROMCLIPBOARD (/ htmlfl PrntWndw CBdata txtstr1)
    (setq
            htmlfl (vlax-create-object "HTMLfile");starts application
            PrntWndw (vlax-get-property htmlfl 'ParentWindow)
            CBdata (vlax-get-property PrntWndw 'ClipBoardData)
    );setq
    ;(vlax-dump-object CBdata t);->displays supported methods: -> fod ClipboardData: clearData, GetData and SetData
    (setq
            txtstr1 (vlax-invoke-method CBdata 'GetData "TEXT");returns variant
            txtstr1 (vlax-variant-value txtstr1);Returns the value of a variant 
    );setq
    (vlax-release-object htmlfl)

    txtstr1
);defun

Example:

Version history:
1.00 - 16.07.2016
1.01 - 03.03.2019 - VLS and ZELX added to supported file formats


Compatibility:
All Autocad versions


File Format:
.Fas


Remarks: 
The application comes with the long command name. To create your own short alias for these command, go to ACAD.PGP file or Menu Manage->Customization->Edit aliases->Edit Aliases. Command alias used in video-example: QA for QUICKAPPLOAD

DEMO:
-Demo version is limited to 4 runs and valid for one day. Platform: Windows.

  QUICKAPPLOAD_v1_01.FAS

No comments:

Post a Comment