; This routine runs the code in the active editor of NotePad++ from AutoCAD:
(defun C:n
++ nil (C:RunFromNotePadPP
)) ; Quick Run (defun C:RunFromNotePadPP
( / scr
*error* err np
++ npeditor npSS npMS r des lsp fn
) ; NOTE: Requires ActiveX plugin(by David Gausmann) installed on the NP++
; https://sourceforge.net/projects/nppactivexplugin/
;| Sample code in the active editor would look like (copy any of the samples in a new editor window that should remain active):
; Sample #1
(defun test ( / q )
(if (setq q (= "Yes" (progn (initget "Yes No") (cond ((getkword "\nSay hello ? [Yes/No] <Yes>: ")) ("Yes")))))
(alert "Hello!")
)
'(I just said hello)
)
(test); <<-- Obviously if you comment the call, it will just load it
; Sample #2
(defun test ( / q )
(if (setq q (= "Yes" (progn (initget "Yes No") (cond ((getkword "\nTHIS IS SAMPLE #2 !! [Yes/No] <Yes>: ")) ("Yes")))))
(alert "Hello!")
)
'sample#2
)
(test)
; Sample #3 - call (C:n++) or (C:RunFromNotePadPP) from VLIDE's console
( (lambda (f) (f 10 nil))
(lambda (n c)
(if (> n 0)
(f (1- n) (cons (* n n) c))
c
)
)
)
; Sample #4 (checking if subfuns are loading aswell)
(defun C:test ( / p )
(and
(setq p (getpoint "\nPick a point: "))
(foreach v (vL 10)
(MkPt (mapcar '+ p v))
); foreach
)
(princ)
)
(defun vL (n) (list '(0 0 0) (list n 0 0) (list 0 n 0) (list (- n) 0 0) (list 0 (- n) 0)))
(defun MkPt (p) (entmake (list '(0 . "POINT") (cons 10 p))))
(C:test)
; Sample #5
'(any type of data can be loaded)
"Wherever it is string, number or symbol, function or an evaluation."
123
'abc
lambda
(mapcar '* '(1 2 3) '(4 5 6))
|;
)
); defun *error*
); lambda
); function
); vl-catch-all-apply
); setq err
)
); and
); defun