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.


;;; =================================================
;;;        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
;;; =================================================
(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
         txtstringlen (strlen txtstring)
         ext1 (strcase (substr txtstring (- txtstringlen 3) txtstringlen) )
                (= 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)
            (princ "\nIts not a path to a Autocad App file")
    ;reading of the name of the lisp
            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
    ;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!!!!!!!!!!!!!!") )
;;; =======================================================
;;;                          TXTFROMCLIPBOARD                           
;;; =======================================================
(defun TXTFROMCLIPBOARD (/ htmlfl PrntWndw CBdata txtstr1)
            htmlfl (vlax-create-object "HTMLfile");starts application
            PrntWndw (vlax-get-property htmlfl 'ParentWindow)
            CBdata (vlax-get-property PrntWndw 'ClipBoardData)
    ;(vlax-dump-object CBdata t);->displays supported methods: -> fod ClipboardData: clearData, GetData and SetData
            txtstr1 (vlax-invoke-method CBdata 'GetData "TEXT");returns variant
            txtstr1 (vlax-variant-value txtstr1);Returns the value of a variant 
    (vlax-release-object htmlfl)



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

All Autocad versions

File Format:

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 version is limited to 4 runs and valid for one day. Platform: Windows.


No comments:

Post a Comment