Toolbar Button Fails to Invoke Script

Toolbar Button Fails to Invoke Script

Anonymous
Not applicable
1,456 Views
22 Replies
Message 1 of 23

Toolbar Button Fails to Invoke Script

Anonymous
Not applicable

(repeated because I lost it once)

 

I created a toolbar. I am trying to have it invoke a script. I click on the toolbar, and it fails to bring up the script. Everything looks right to me, but it doesn't call the script. Can someone guide me to how I find out what I did wrong?

0 Likes
1,457 Views
22 Replies
Replies (22)
Message 2 of 23

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

Can you attach the command that you are trying to run?

 

I look forward to helping you.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 3 of 23

TheCADnoob
Mentor
Mentor

did you check in the CUI to make sure the script as it should be?

CADnoob

EESignature

0 Likes
Message 4 of 23

Anonymous
Not applicable
Yes. I can't detect anything all by myself that is standing out as being
incorrect from
what I know.

I must be missing a detail that I don't understand.
0 Likes
Message 5 of 23

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

as mentioned: please show the syntax of the command you use behind your cui-button.

Another question: what happens when you start command _SCRIPT with your file manually?

At least: look to the security options (like trusted paths in the _OPTIONS dialog as well as the setting of the sysvar SECURELOAD, maybe the script file is stored at a path not allowed to run an app from.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 6 of 23

Anonymous
Not applicable


 





Hi,



 



as mentioned: please show the syntax of the command you use behind your cui-button.



Another question: what happens when you start command _SCRIPT with your file manually?



At least: look to the security options (like trusted paths in the _OPTIONS dialog as well as the setting of the sysvar SECURELOAD, maybe the script file is stored at a path not allowed to run an app from.



 



This is the code behind the button:



^C^C(load "c:/structural/system/lsp/shlm.lsp");shlm;



 



When I use (load "c:/structural/system/lsp/shlm.lsp");



It brings it up successfully,



 



and when I execute it, it starts the routine, (although it's not really functional at this state of development).



 



I need to research how to do what you are saying about the _OPTIONS dialog and SECURELOAD, (I have never heard of that issue before).



 



I am using random web articles to guide me, because even though I have a whole collection of Autocad books, there is no "system" to their organization to guide me.

0 Likes
Message 7 of 23

john.vellek
Alumni
Alumni

HI @Anonymous

 

When I put this ^C^C^p(load "c:/structural/system/lsp/shlm.lsp");shlm into the command line for a menu button it looks like it is working.

 

TO add the Folder to the Trusted Locations, simply type Options and then select the File tab. You can then add your folder to the list of Trusted Locations.

 

Capture.PNG

 

Please select the Accept as Solution button if my post fully solves your issue or answers your question.

 

 


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 8 of 23

john.vellek
Alumni
Alumni

Hi @Anonymous,

 


I am checking back to see if my post helped you with your problem. Please add a post with your results so other Forum users can benefit.

Please hit the Accept as Solution button if my post fully solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 9 of 23

Anonymous
Not applicable
The problem still exists on my system. What you told me to do doesn't work to solve it.


 


I am completely lost as to what I should try next.
0 Likes
Message 10 of 23

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

Please attach your LISP routine and I will duplicate your setup to see what might be the problem.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 11 of 23

Anonymous
Not applicable
I personally like to think that the process of solving this issue is a methodical/analytical process.


 


Can you describe to me what it is that I have to do in the case of this bug to figure out where the issue is?


 


(Like with a sequence of steps)?
0 Likes
Message 12 of 23

john.vellek
Alumni
Alumni

HI @Anonymous,

 

This is what I would do on my own system.

 

  • Create a folder for my custom LISP routines. Name it something like MYLSIP
  • Open AutoCAD and add MYLISP to the Trusted Locations list as I showed in post 7
  • Move my copy of SHLM.lsp to that folder.
  • In AutoCAD, start CUI
  • Navigate to the button that will call your routine.
  • For the command I suggest:  ^c^c(if (null c:shlm)(load "SHLM"));^PSHLM;

 

Close the CUI and try the button.

 

Please select the Accept as Solution button if my post fully solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 13 of 23

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

just to add to

>> Close the CUI and try the button.

...and watch the command line, what it reports!

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 14 of 23

Anonymous
Not applicable
When I place that code snippet into the button, (and even when I try variations on it), the script will not come up.


I placed "c:/structural/system/lsp/" which is where the code sample is into the "Trusted Locations".


 


When you click on the button, nothing at all happens.
0 Likes
Message 15 of 23

Anonymous
Not applicable
The command line reports absolutely nothing.
0 Likes
Message 16 of 23

john.vellek
Alumni
Alumni

Please attach the file so I can take a look at it.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 17 of 23

Anonymous
Not applicable
Meaning,


does it involve really sophisticated knowledge of either the hardware or of the design of Autocad?


 


if it is just something trivial that I overlooked, then I am willing to spend some time reading up on how


to figure it out.
0 Likes
Message 18 of 23

john.vellek
Alumni
Alumni

HI lgojer123,

 

The steps I outlined should work for you as they did on my system. Without looking at the file now I am at a loss on how else to direct you. If you attach it I can play with it a bit to see what might be causing the problem.

 

BTW, please don't keep changing the subject line of your posts. It is hard for those of us following the thread when it changes.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 19 of 23

Anonymous
Not applicable
The file must not be reaching you.


 


 
0 Likes
Message 20 of 23

john.vellek
Alumni
Alumni

Hi @Anonymous, Are you attaching the file to your post? Try putting it in a ZIP file first and then attaching. if you check your posts you will be able to see if the attachments stuck

 

 

Some users complain that their firewalls block the attachments


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes