View Full Version : Help With Shell Command
vferrara
2005-06-09, 08:30 PM
Hello to All Augi Members:
In the past, I was able to have a lisp routine run the the Adobe Acrobat Reader from the "shell" command. Now I am running AutoCAD 2005 and I am trying to accomplish a similar task however, I am having a problem trying to get the Adobe Reader to open.
Below is the lisp code I am using:
;;;;;;;;Start Code
(defun c:XYZ11 ()
(SETVAR "CMDECHO" 0)
(command "shell" "P:\\PROGRAMS\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe H:\\cad4\\menu\\ABCDE.pdf")
(SETVAR "CMDECHO" 1)
(princ)
)
;;;;;;;Code End
Does anyone have any suggestions...??
Your assistance would be appreciated.
Regards,
Vince
madcadder
2005-06-09, 08:59 PM
(DEFUN c:XYZ11 (/ runprogram filetorun)
(SETVAR "CMDECHO" 0)
(SETQ runprogram "P:\\PROGRAMS\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe")
(SETQ filetorun "H:\\cad4\\menu\\ABCDE.pdf")
(STARTAPP runprogram filetorun)
(SETVAR "CMDECHO" 1)
(PRINC)
)
Changed it to my program files directory and tested a file in my root c:
Did not test over network. Let me know if it still has issues...
vferrara
2005-06-10, 07:24 PM
Tod:
I could not get your code to run in a networked environment. However, I did some more research and found out that I am having a problem with spaces in the directory path such as the Acrobat 7.0 . If I remove the space then my routine works fine but the network administrator does not want to change the default install path for the Acrobat program.
Is there a way (special characters, brackets, etc.) to have lisp read the path with the spaces included and still run properly.
Your help is appreciated.
Regards,
Vince
Vince,
See if this thread can help you out any.
STARTAPP ??? (http://forums.augi.com/showthread.php?t=20198)
madcadder
2005-06-10, 08:04 PM
Tod:
I could not get your code to run in a networked environment. However, I did some more research and found out that I am having a problem with spaces in the directory path such as the Acrobat 7.0 . If I remove the space then my routine works fine but the network administrator does not want to change the default install path for the Acrobat program.
Is there a way (special characters, brackets, etc.) to have lisp read the path with the spaces included and still run properly.
Your help is appreciated.
Regards,
Vince
what is the exact path and file name on the network and I'll fix the lisp?
vferrara
2005-06-10, 08:33 PM
Tod:
The path and pdf file name were in the original post but here it is again:
(command "shell" "P:\\PROGRAMS\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe H:\\cad4\\menu\\ABCDE.pdf")
As I mentioned before, if I remove the space between Acrobat and 7.0 the routine works OK but with the space it does not run.
Thanks again....!
Regards,
Vince
madcadder
2005-06-10, 08:58 PM
Sorry. ABCDE.pdf just sounded fake. :-)
I had issues with the file on the network not the program on my local drive, so I can't test this myself.
try this:
(DEFUN c:xyz11 (/ |program| |file|)
(SETVAR "CMDECHO" 0)
(SETQ
|program|
"c:\\PROGRAM FILES\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe"
)
(SETQ |file| "H:\\cad4\\menu\\ABCDE.pdf")
(STARTAPP (STRCAT "\42" |program| "\42") |file|)
(SETVAR "CMDECHO" 1)
(PRINC)
)
(command "shell" "P:\\PROGRAMS\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe H:\\cad4\\menu\\ABCDE.pdf")
change the above line to read
(command "shell" (strcat (chr 34) "P:\\PROGRAMS\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe" (chr 34) " H:\\cad4\\menu\\ABCDE.pdf"))
Tod,
You beat me to the punch. :p
madcadder
2005-06-10, 09:07 PM
Tod,
You beat me to the punch. :p
If it works...
Plus, I gotta see if I actually learned something from the other thread.
If it works...
Plus, I gotta see if I actually learned something from the other thread.
It appears you did. Also, if the filename (pdf) he is looking to open contains spaces in it, The "\42" or (chr 34) will need to be added before and after the directory\filename.
madcadder
2005-06-10, 09:51 PM
It appears you did. Also, if the filename (pdf) he is looking to open contains spaces in it, The "\42" or (chr 34) will need to be added before and after the directory\filename.
I was thinking that too, but I wanted to get the program to open first and then see if it bombed on the file.
I'm still stumped as to why I had such problems when testing my original. When testing this for the PDF instead of an XLS it worked just fine over the network with spaces in the path and file names both, yet Vince was/is having issues and needed the "/42" or (chr 34) 's.
Something tells me in the future I will write all STARTAPP's like this with either or for safety.
Tod
vferrara
2005-06-10, 11:31 PM
Rich and Tod:
I'm sorry for the confusion, the correct name of the pdf file is THE-ACAD-USER_GUIDE.pdf.
If it is not too much to ask what does the (chr 34) represent....???
Thanks for the help.
Rich and Tod:
I'm sorry for the confusion, the correct name of the pdf file is THE-ACAD-USER_GUIDE.pdf.
If it is not too much to ask what does the (chr 34) represent....???
Thanks for the help.
The (chr 34) places a quote mark in the string. From the thread I mentioned earlier, it should do the same thing as the "\42". chr converts the number to its ascii code representation.
madcadder
2005-06-10, 11:49 PM
(DEFUN c: xyz11 (/ |program| |file|)
(SETVAR "CMDECHO" 0)
(SETQ |program| "C:\\PROGRAM FILES\\ADOBE\\ACROBAT 7.0\\READER\\AcroRd32.exe")
(SETQ |file| "H:\\CAD4\\MENU\\THE-ACAD-USER_GUIDE.pdf.")
(STARTAPP (STRCAT "\42" |program| "\42") (STRCAT "\42" |file| "\42"))
(SETVAR "CMDECHO" 1)
(PRINC)
)
Try this... take the space out of c: xyz11
kept wanting to put a face there.
vferrara
2005-06-13, 04:50 PM
Rich and Tod:
Thank you for the update. With your input the routine now works OK....!!
Regards,
Vince
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.