Author Topic: LspLoad: "Unknown command" - and still working  (Read 4176 times)

Peter2

  • Sr. Member
  • ****
  • Posts: 475
LspLoad: "Unknown command" - and still working
« on: August 07, 2013, 03:54:45 PM »
Hi

I started to try LspLoad and Innosetup and made these steps:

- write a Lisp, include the ODCL-code
- the lisp has (simplfied):
Code: (autolisp) [Select]
(princ "hello")
(command "doslib")
(command "opendcl")
(defun c:test ()
   (alert "test)
)
- compiled to "test.VLX"
- Used Innosetup for a package
  -  which copies VLX + LspLoad + OpenDCL runtime files + Doslib to an userdefined folder
  -  creates all registry-entries for "Applications" for (renamed) LspLoad + ODCL + Doslib
  - LOADCTRLS is 4 - command invoke

To make it short - it works, but with a confusing error. Here is my (modified and translated) protocol

Code: (autolisp) [Select]
Command: test     ----> this is my first command
Unknown Command "test"". Press F1 for help.

Command:    ----> here Acad continues without new user-interaction
hello    ----> this is from "princ"
doslib    ----> this is from (command "doslib") plus autoload
DOSLib 9.0.1
Copyright © 1992-2012, Robert McNeel and Associates

DOSLib Loaded.

Command: opendcl     ----> this is from (command "opendcl")
OpenDCL Runtime loaded

Command:    ----> here ends the first command: everything loaded, nothing started and "unknown command" above

Command: test     ----> this is my second command
4      ----> this is maybe the value of "loadctrls" (4)
Lisp is executed ...

So my questions are:
- Is it correct that the first command reports "unknown" and load everything?
- Is it possible that "first load" and "first execution" is done at the same time?

Thanks

Peter
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3059
    • Outside The Box
Re: LspLoad: "Unknown command" - and still working
« Reply #1 on: August 07, 2013, 06:50:45 PM »
AutoCAD has to switch between application context (to load the .arx module) and document context (to load the lisp file), and (primarily) for that reason it's not practical to define the command immediately when the LspLoad .arx module loads. Therefore, you should define the LOADCTRLS to load at startup, and either load your entire application at startup as well, or at least load a short lisp file that defines stub commands which load the real application (redefining themselves in the process) the first time the command is used.

Peter2

  • Sr. Member
  • ****
  • Posts: 475
Re: LspLoad: "Unknown command" - and still working
« Reply #2 on: August 09, 2013, 07:58:01 AM »
... or at least load a short lisp file that defines stub commands which load the real application (redefining themselves in the process) the first time the command is used.
Thanks Owen, I will take a look.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10