Auto load lisps from network

anieves228
Enthusiast
Enthusiast

Auto load lisps from network

anieves228
Enthusiast
Enthusiast

Hi all!

I'm brand new to lisps and I have made decent progress these pasts 2 weeks. 

I'm working on autoloading lisps from our network. I put the acaddoc.lsp in the support folder and auto cad reads it. Now I want my acaddoc.lsp file to load a file from our network. Im not sure how I can achieve this. Here is my code:

 

;****************************************************************************************
;AUTO RUN UPON OPENING NEW DWG
;location: C:\Program Files\Autodesk\AutoCAD 2019\Support


(load "\\gsgfs02\\CAD\\Automation\\Lisp Routines\\TESTING\\gsg autoload.lsp")

(PROMPT "GSG AUTO LISP LOADED.")
(PRINC)

;END AUTO RUN
;****************************************************************************************

 

 

Thanks!

0 Likes
Reply
Accepted solutions (1)
1,262 Views
4 Replies
Replies (4)

roland.r71
Collaborator
Collaborator
Accepted solution

@anieves228 wrote:

Hi all!

I'm brand new to lisps and I have made decent progress these pasts 2 weeks. 

I'm working on autoloading lisps from our network. I put the acaddoc.lsp in the support folder and auto cad reads it. Now I want my acaddoc.lsp file to load a file from our network. Im not sure how I can achieve this. Here is my code:

 

;****************************************************************************************
;AUTO RUN UPON OPENING NEW DWG
;location: C:\Program Files\Autodesk\AutoCAD 2019\Support


(load "\\gsgfs02\\CAD\\Automation\\Lisp Routines\\TESTING\\gsg autoload.lsp")

(PROMPT "GSG AUTO LISP LOADED.")
(PRINC)

;END AUTO RUN
;****************************************************************************************

 

 

Thanks!


 

Welcome!

 

A network or UNC path starts with the servername, preceded by a double slash (all) or double backslash (Windows only)

 

So after adding another backslash to tell acad you realy want a backslash, your path should look like:

(load "\\\\gsgfs02\\CAD\\Automation\\Lisp Routines\\TESTING\\gsg autoload.lsp")

or

(load "//gsgfs02/CAD/Automation/Lisp Routines/TESTING/gsg autoload.lsp")

 

I personally prefer to use the latter.

0 Likes

anieves228
Enthusiast
Enthusiast

Awesome thank you!

And whats the latter?

0 Likes

roland.r71
Collaborator
Collaborator

The last option given.

So, / instead of \

It prevents problems with \ being an escape char. altogether, instead of escaping the escape char.

& it looks better.

 

But as I said, its just a matter of preference.

0 Likes

scot-65
Advisor
Advisor
Try this for a more predictable result
(if load fails, prompt still says it is successful).

(princ (strcat "\n GSG Auto LISP "
(if (load "[YourLoadPathHere]" nil)
"Loaded. " "Failed. ")))
(princ)

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.