Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling an AutoCAD script from OLE Automation...
Message
General information
Forum:
CAD
Category:
Other
Miscellaneous
Thread ID:
00410680
Message ID:
00411330
Views:
18
>Roi correct me if I am wrong but some thing is missing in your function.
>When you call the Lisp command you are missing the "_Script" command.
>What if we do a lisp like this?

Doh! That'll teach me not to test code I post. Sorry. You should also add the . before the underscore as well. The period forces AutoCad to use the real command if it has been redefined. The underscore translates the command to the correct language.
(RunScript "c://My Happy Places//Some.scr")
(defun RunScript (ScriptName)
    (command "._script" ScriptName)
 )
>Is it true that AutoCAD will run the ACAD.lsp if it found in the same dir of the .dwf file?

Yep. From the help "AutoCAD searches for an acad.lsp file in the order defined by the library path; therefore, you can have a different acad.lsp file in each drawing directory. You can then load specific AutoLISP routines for certain types of drawings or jobs."

It took me awhile to find it in help but it is located at:
Customization Guide
    Part 1 - Customization Reference
        Chapter 6 - Programming Interfaces
            AutoLisp
                automatic Loading and Execution
                    The acad.lsp file
>
>>>>
>>>>;;; Run a script.
>>>>;;; Just pass the script name as an argument, you probably should
>>>>;;; pass the full path.
>>>>;;; ex: (RunScript "c://My Happy Places//Some.scr")
>>>>(defun RunScript (ScriptName)
>>>> (command ScriptName)
>>>>) ;_End of defun
>>>>
>>>>You might want to hop on over to the AutoDesk NewsGroups and ask them. Someone might know of an easy way to do it.
>>>>
>>>>hth
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Reply
Map
View

Click here to load this message in the networking platform