Author Topic: Launch ACAD and run script  (Read 5216 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
Launch ACAD and run script
« on: September 18, 2007, 01:15:59 PM »
I know you can use a switch in the shortcut to run a script upon startup, but I was wondering if you can do it using STARTAPP (or some VLispy-type o' code).  I.E.  (startapp "C:\\CADD\\AMEP2008\\acad.exe").

deegeecees

  • Guest
Re: Launch ACAD and run script
« Reply #1 on: September 18, 2007, 01:31:19 PM »
Do you want to run it only when AutoCad starts, or with every drawing?

Guest

  • Guest
Re: Launch ACAD and run script
« Reply #2 on: September 18, 2007, 01:35:46 PM »
Here's what I was thinking....

Use STARTAPP to launch a session of ACAD.  Once that session is done loading, run a script.  This script will in turn open multiple drawings and do something to each one.

deegeecees

  • Guest
Re: Launch ACAD and run script
« Reply #3 on: September 18, 2007, 01:40:41 PM »
From a stand alone VB app, or within a session of AutoCad?

With my limited knowledge, I'm not sure if I'd use ODBX, or a batch process. I don't have full blown VB here at work, and my "Student" copy is fairly old, so I'll just go on record as saying...

...hmmm...

Guest

  • Guest
Re: Launch ACAD and run script
« Reply #4 on: September 18, 2007, 01:43:15 PM »
From a stand alone VB app, or within a session of AutoCad?

From LSP.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Launch ACAD and run script
« Reply #5 on: September 18, 2007, 01:45:01 PM »
You can't run lisp unless you have AutoCAD open .. so I would have to question the need to open AutoCAD if it is already open.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

deegeecees

  • Guest
Re: Launch ACAD and run script
« Reply #6 on: September 18, 2007, 01:47:15 PM »
Well I've posted this before, but in lew of searching for it, I'll post it here. In spite of it's ugliness, this has worked for me for years.

Code: [Select]
(DEFUN C:batch_anything ()

;;;;;;;;;;;;;;;;;;;;;;;;;Select directory to be processed

(setq dfil (getfiled "Select A File In The Directory You Want To Batch Process" "p:/" "dwg" 0))
(setq wutdir (vl-filename-directory dfil))
(setq wutfiles (vl-directory-files wutdir "*.dwg"))

(setq scrfile (open "c:\\scrfile.scr" "w"))
(close scrfile)
(setq scrfile (open "c:\\scrfile.scr" "a"))

(foreach n wutfiles
(setq n2 (strcat "\""wutdir "\\" n "\""))
(setq n2 (vl-string-translate "\\" "\\" n2))
(setq scrline (strcat "open" " " n2 " " "(load\"batch_core\")" " " "batch_insert" " " "qsave" " " "close"));;;;;;;COMMANDS FOR BATCH GO HERE
(write-line scrline scrfile)
(princ)
)

(close scrfile)
(command "script" "c:\\scrfile")

(princ "\n***Batch complete.***")
(princ)


);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEFUN

This works from an open AutoCad session.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Launch ACAD and run script
« Reply #7 on: September 18, 2007, 06:46:05 PM »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Guest

  • Guest
Re: Launch ACAD and run script
« Reply #8 on: September 19, 2007, 08:30:34 AM »

Matt, have you tried ScriptPro ?
http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=4091678&linkID=9240618

No, I haven't, and I doubt I'll be able to get the IT geeks to download and install it for me.  Have you used it before?  One thing that caught my eye was the "robust error recovery".  How does this work?  If it encounters an error in a drawing, will it skip that drawing and move on to the next??

I'll see if I can scrounge up some jelly donuts to bribe the geeks.  :wink:

Guest

  • Guest
Re: Launch ACAD and run script
« Reply #9 on: September 19, 2007, 08:33:03 AM »
You can't run lisp unless you have AutoCAD open .. so I would have to question the need to open AutoCAD if it is already open.

1) It was a curiosity thang and
2) I was just trying to eliminate the need for some people here to have to think.  Because we all know how some people can't grasp even the simplest of concepts.  We all have at least one of those people in the office - well, except for Josh - they just got rid of theirs!