tzframpton Posted January 16, 2012 Posted January 16, 2012 I'm wanting to know if I can open a program (or any file rather) directly from AutoCAD? What I'm trying to accomplish is this: We are building a library of Tool Palettes that are "client specific" with use of Profiles in AutoCAD. At the top of each group of Tool Palettes we want an "Info" tab. From there, they can click an icon that will bring up the PDF document of the standards we receive from the client, so that if there's any confusion the drafter can always rely on the Info Tab of the Tool Palettes. We'll also want to link to other things, such as Word documents, maybe a job directory, Excel files with certain job schedules, etc. Can this be done with ease? I've been trying to type into the Command Line path directories after initiating the SHELL command but I'm coming up way empty handed. Thanks in advance. Quote
alanjt Posted January 16, 2012 Posted January 16, 2012 You can you wscript, but the easiest way would be to utilize the start command. eg. Command: start Application to start: c:\\300.pdf code: (command "_.start" "c:\\300.pdf") Quote
tzframpton Posted January 16, 2012 Author Posted January 16, 2012 Perfect!! Works great. I guess there can't be any spaces in the file name? I had to replace space with an underscore. Soon as I did that, things started opening correctly. Exactly what I need, thanks yet again for your pimpin' skillz Alan. Quote
alanjt Posted January 16, 2012 Posted January 16, 2012 From what I remember, spaces will work if calling directly from TP if put them in a command set (command "_.shell" ...") instead of treating it like a macro. Quote
alanjt Posted January 16, 2012 Posted January 16, 2012 Here's a wscript example, but I don't really see it being needed... (defun AT:OpenFile (file / s r) ;; Open specified file ;; file - file to open ;; Alan J. Thompson, 11.16.10 (if (setq file (findfile file)) (progn (setq r (vl-catch-all-apply (function (lambda (/) (vlax-invoke (setq s (vlax-create-object "Shell.Application")) 'Open file) ) ) ) ) (vlax-release-object s) (not (vl-catch-all-error-p r)) ) ) ) Quote
tzframpton Posted January 16, 2012 Author Posted January 16, 2012 Actually I tried to put the command set directly in the Command String text area in the Tool Palette directly, and it failed with this error: Command: (command "_.start" "C: So then I made a quick routine and it works from the Tool Palette if I just call the function: (defun C:TEST (/) (command "_.start" "C:\\Autodesk\\TDP_CADD_Standards_Manual.pdf" ) ) But I can live with that. That's what spawned my other post in the LISP section about combining multiple commands into one file. Quote
tzframpton Posted January 16, 2012 Author Posted January 16, 2012 Here's a wscript example, but I don't really see it being needed... (defun AT:OpenFile (file / s r) ;; Open specified file ;; file - file to open ;; Alan J. Thompson, 11.16.10 (if (setq file (findfile file)) (progn (setq r (vl-catch-all-apply (function (lambda (/) (vlax-invoke (setq s (vlax-create-object "Shell.Application")) 'Open file) ) ) ) ) (vlax-release-object s) (not (vl-catch-all-error-p r)) ) ) ) Oh crap, that's way above me! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.