LISP to run a script on startup?

LISP to run a script on startup?

Colby_MickelberryAEN2P
Contributor Contributor
1,630 Views
26 Replies
Message 1 of 27

LISP to run a script on startup?

Colby_MickelberryAEN2P
Contributor
Contributor

I have a script that I want to run on start up, it basically changes the width factor of our standard text since we did a company wide style change. The script i wrote works but I would like the LISP to run the script when someone opens a cad file. From all the forms i read it looks possible but Im struggling the right code in the lsp file (since the start up suit doesnt work with scripts). I know i have to appload the lsp and add it to the start up suite.

 

If anyone could help provide some direction I would really appreciate it! 

0 Likes
1,631 Views
26 Replies
Replies (26)
Message 21 of 27

paullimapa
Mentor
Mentor

Try this to see if your Change Width_Factor.lsp. is actually working 

Add this line to the beginning of that lisp :

(alert "This is my lisp")

Then also add to the beginning of your Change_Width.scr:

(alert "This is my Script")

Now when you open a dwg see if you get both of those alert messages


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 22 of 27

Colby_MickelberryAEN2P
Contributor
Contributor

I added the alert and it show up whenever i open a cad file, so it must be something with its not running the command?

0 Likes
Message 23 of 27

paullimapa
Mentor
Mentor

So if both the alerts in the lsp and the scr files show up then the script file is running but the commands you are running within that script file on that dwg are not working properly. Perhaps you can share a sample dwg with that style you want to change so we can test that for you here


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 24 of 27

Colby_MickelberryAEN2P
Contributor
Contributor

I take that back, so I'm getting an alert in my lsp file but not the scrip file. So I am wondering if my commads in my script are not tell it to run.

0 Likes
Message 25 of 27

paullimapa
Mentor
Mentor

That means your lisp is not finding that script file to run. Make sure the path and name shown matches with where your script file is saved 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 26 of 27

Sea-Haven
Mentor
Mentor

Post your lisp code.

0 Likes
Message 27 of 27

ec-cad
Collaborator
Collaborator

Rather than run a script (.scr file), why not just add it to your startup.

Just copy / paste this code into your acad.lsp or acaddoc.lsp.

Setting the TextHeight is up to you. Hint (setvar "Textsize" 2.5).

And, you can reset to Arial by typing SET-TEXT-ARIAL at the Command Prompt line.

 

(defun C:SET-TEXT-ARIAL ()
 (command "_-style" "Arial" "Arial" "0" "0.95" "0" "N" "N")
 (princ "\nText Style set to Arial with width factor of 0.95")
 (princ)
); function
(C:SET-TEXT-ARIAL)
(princ)

 

Cheers.

ECCAD

0 Likes