How to appload without dialogue box

How to appload without dialogue box

Anonymous
Not applicable
3,758 Views
24 Replies
Message 1 of 25

How to appload without dialogue box

Anonymous
Not applicable

Hello, everyone

 

I'd like to execute an appload command without the dialogue box.

I don't know how to do that, so I wrote PowerShell codes below:

# PowerShell codes
[System.Windows.Forms.SendKeys]::SendWait("_appload ") [System.Windows.Forms.SendKeys]::SendWait("%n") # Alt+N [System.Windows.Forms.SendKeys]::SendWait("xyz.lsp") [System.Windows.Forms.SendKeys]::SendWait("%(lc)") # Alt+L & Alt+C

and run it.

 

 

But I don't like SendWait because it runs asynchronously, that is, it doesn't wait until the command finishes. Instead, I'd like to do that like next:

# PowerShell codes
$acad = New-Object -ComObject AutoCAD.Application $doc = $acad.Documents.ActiveDocument $doc.SendCommand("(command `"_appload`" `"xyz.lsp`")") # This doesn't work

The last line causes the dialogue box, but `xyz.lsp' isn't entered to the text box in it.

 

 

Does anyone have a good idea?  I don't care if you use another command except appload.

 

I use AutoCAD 2011 on Windows 7.

I'd like to draw tens of cross sectional views, and each view has hundreds of LWPolylines. I have as many AutoLISP files as sections to draw. Each file (like xyz.lsp) is for a section drawing.

 

Thank you.

0 Likes
Accepted solutions (1)
3,759 Views
24 Replies
Replies (24)
Message 2 of 25

pendean
Community Legend
Community Legend
Read Method #2 on this page http://www.lee-mac.com/autoloading.html


Message 3 of 25

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

to load a LISP file you don't need to use command _APPLOAD, instead try that:

(load "xyz.lsp")

- 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 4 of 25

Anonymous
Not applicable

I've looked for the answer for these days, but you gave me for only a few minutes.

Thank you very much. Great!

0 Likes
Message 5 of 25

mc5fan
Advocate
Advocate

This is not working for me. I am using AutoCAD 2019. My .lsp files reside in C:\LISP. Can you assist me?

Lee M.
0 Likes
Message 6 of 25

diagodose2009
Collaborator
Collaborator

Always you this method

(setq h_diskinfo (findfile "codstree.lsp"))
(if h_diskinfo (load h_diskinfo) (alert "Not found CoDsTRee.exe"))
(terpri)
0 Likes
Message 7 of 25

mc5fan
Advocate
Advocate

I assume that other than the .LSP name I am required to alter this text further. Pasting (setq h_diskinfo (findfile "RTB1.lsp")) onto the command line does find the script.

 

I am nowhere near as knowlegeable as you and do not know what I have to do to make this work. Can you further assist?

Lee M.
0 Likes
Message 8 of 25

Kent1Cooper
Consultant
Consultant

@mc5fan wrote:

This is not working for me. I am using AutoCAD 2019. My .lsp files reside in C:\LISP. Can you assist me?


It should be enough to just add that folder to the Support File Search Path list in the OPTIONS dialog box:

Kent1Cooper_0-1611856932541.png

 

Add C:\LISP to that list, and the format in Message 3 should work.  In fact, you don't even need the filetype ending:

(load "RTB1")
Kent Cooper, AIA
0 Likes
Message 9 of 25

mc5fan
Advocate
Advocate

Thank You. That works fine. Yes, I already set my search path and trusted folder. When I put (load "RTB1") in the command line, the .LSP loads. When I put (load "RTB2") in the command line, the .LSP loads.

 

I want to write a script to load several .lsp files but I am having no success incorporating both into a script. I have tries many different variations and am getting nowhere.

 

Lee M.
0 Likes
Message 10 of 25

mc5fan
Advocate
Advocate

This worked:

 

(load "RTB1")(load "RTB2")

Lee M.
0 Likes
Message 11 of 25

Sea-Haven
Mentor
Mentor

To mc5fan are you trying to load on startup ? Several methods available.

0 Likes
Message 12 of 25

mc5fan
Advocate
Advocate

I was having to load the .lsp files in AutoCAD.  1st I incorporated them into a script to load them with each new drawing. Then I used APPLOAD to load them at startup  I figured it out. I now have a long script that runs my script dialog and several individual generic scripts and .lsp routines. I d, however need to put in 1 keyboard entry as I cannot figure out how to automate that.

 

I need to figure out how to emulate pressing the ENTER key when a dialog box pops up. Any ideas????

Lee M.
0 Likes
Message 13 of 25

Kent1Cooper
Consultant
Consultant

@mc5fan wrote:

I was having to load the .lsp files in AutoCAD.  1st I incorporated them into a script to load them with each new drawing. ....


You don't need a Script or APPLOAD for that.  Put them in acaddoc.lsp [either the routine definitions directly in it, or with (load) functions as above in it], and they will be loaded in every drawing, whether new or opened-existing.

Kent Cooper, AIA
0 Likes
Message 14 of 25

Sea-Haven
Mentor
Mentor

Like Kent autoload but I use the Appload "Start up Suite" adding the programs I wanted started there, I only have like 3.

 

If you have multiple lisps look at putting into 1 and load.

 

Re stop dialouges it sounds like your changing stuff on start up why not just fix this problem by using a correct Template where all the values are set. You can have different icons on your desktop so open correct template on start up. Command Line Switch Reference | AutoCAD 2018 | Autodesk Knowledge Network

0 Likes
Message 15 of 25

mc5fan
Advocate
Advocate

Thanks for the reference but it does not apply to what I am doing . Some dialog boxes cannot be stopped. It is triggered from running my script. There are many functions that will open a dialog box with no way around it. I just need to know how to get the jump and throw an ENTER keystroke into the mix.

I use LeeMac Programming JUSTIFY BASE POINT .LSP to move the base point in a title block. I have to fix the messed up base point to run the script. It is generating the dialog box. It is the only ketstroke that I have to enter. I want to eliminate that key stroke.

http://www.lee-mac.com/justifybasepoint.html


 

 

Lee M.
0 Likes
Message 16 of 25

mc5fan
Advocate
Advocate

.

Lee M.
0 Likes
Message 17 of 25

mc5fan
Advocate
Advocate

acaddoc.lsp is not an option. Take my word, I do not want to argue about it. APPLOAD works just fine. I also will load a .lsp if necessary from within my script. I am NOT a CAD guru. I do not have a macho mindset so I will learn and grow at my own pace. I am just learning to make more complicated things happen. I had a major breakthrough today and am very happy with my progress.

 

Everyone here is awesome in knowledge and very helpful. Thank you very much!!!!

Lee M.
0 Likes
Message 18 of 25

Sea-Haven
Mentor
Mentor

Sorry for Mc5fan

 

I dont understand running code on startup to set stuff, particuarly if your just pressing enter to continue have you tried (setvar 'filedia 0) and see what happens. Or some command just put a - in front eg "-insert" no dialouge.

0 Likes
Message 19 of 25

mc5fan
Advocate
Advocate

I am not running anything on startup.

Lee M.
0 Likes
Message 20 of 25

hmunsell
Mentor
Mentor

im using 2023 now and the Load command seems to only work with SHX.... any update on this? is there a work around for loading LSP from the command prompt for 2023?

Howard Munsell
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.



EESignature


0 Likes