Is it possible to have a lisp routine that runs an .exe file? or .html? .swf? .mov? Thanks!
Yep------>^C^Cshell START IEXPLORE http://sweets.construction.com; and---->^C^Cshell START ACRORD32 m:/cvgdgi/GENERAL/DOCUMENTS/Log-it HELP.pdf; -- Servo "You gonna do something? Or just stand there and bleed?" tservo100 at ameritech dot net Slow, fiery death to all spammers!!!
ahh, I have just what you want. lisp to run PDF (faster than calling explorer.exe...) (DEFUN CT-RUNPDF (NAME / DONE END EXE FILENAME INDEX PDFREG START STRING) ;TRY TO GET LOCATION OF PROGRAM (IF (NOT (vl-registry-read "HKEY_CURRENT_USER\\SOFTWARE\\Acrobat Settings\\" "AcrobatEXE")) (IF (AND (SETQ PDFREG (vl-registry-read "HKEY_CLASSES_ROOT\\AcroExch.Document\\shell\\Open\\command")) (SETQ END (vl-string-search ".EXE" (STRCASE PDFREG))) ) (PROGN ;GET ACTUAL EXE (SETQ STRING (SUBSTR PDFREG 1 (+ END 4)) DONE 0 INDEX 1 ) (WHILE (AND (= DONE 0) (< INDEX (STRLEN STRING)) ) (IF (WCMATCH (SUBSTR STRING INDEX 1) "@") (SETQ DONE 1 START INDEX ) ) (SETQ INDEX (+ 1 INDEX)) ) (SETQ EXE (SUBSTR STRING START)) ;SAVE TO REGISTRY (IF (AND EXE (WCMATCH (STRCASE EXE) "*.EXE")) (REG-WRITE "Acrobat Settings\\" "AcrobatEXE" EXE) ) ) ;ELSE GET FROM USER (PROGN (ALERT "Could not find Acrobat Reader, please Browse for the program") (SETQ EXE (GETFILED "Select Acrobat Reader EXE" "C:\\PROGRAM FILES\\" "exe" 32)) (IF (NOT EXE) (VL-EXIT-WITH-VALUE 1) ) ;SAVE TO REGISTRY (IF (AND EXE (WCMATCH (STRCASE EXE) "*.EXE")) (REG-WRITE "Acrobat Settings\\" "AcrobatEXE" EXE) ) ) ) ;ELSE USE REG ONE (SETQ EXE (vl-registry-read "HKEY_CURRENT_USER\\SOFTWARE\\Acrobat Settings\\" "AcrobatEXE")) ) ;FIND PDF (IF (NOT (SETQ FILENAME (FINDFILE NAME))) (PROGN (ALERT (STRCAT "File " NAME " cannot be found.")) (VL-EXIT-WITH-VALUE 1) ) ) ;RUN WITH ACROBAT (IF (NOT (FINDFILE EXE)) (PROGN (ALERT "Acrobat cannot be found so file cannot be run.") (VL-EXIT-WITH-VALUE 1) ) ) (vl-arx-import 'Startapp) (STARTAPP EXE FILENAME) ) Now one to run any file: (DEFUN C:CT-WINRUN (NAME / FILENAME ) (IF (NOT (SETQ FILENAME (FINDFILE NAME))) (PROGN (ALERT (STRCAT "File " NAME " cannot be found.")) (VL-EXIT-WITH-VALUE 1) ) ) (IF (NOT (FINDFILE (STRCAT (GETENV "SYSTEMROOT") "\\EXPLORER.EXE"))) (PROGN (ALERT (STRCAT "Explorer cannot be found so file cannot be run.")) (VL-EXIT-WITH-VALUE 1) ) ) (vl-arx-import 'Startapp) (STARTAPP (STRCAT (GETENV "SYSTEMROOT") "\\EXPLORER.EXE") FILENAME) ) I am proud of the first routine, that solved the problems with explorer taking too long to open PDF's I compile my lisps so hence the (vl-arx-import 'Startapp)... The last routine is pretty generic enjoy calpolyarc <> |>Is it possible to have a lisp routine that runs an .exe file? or .html? .swf? .mov? Thanks! James Maeding Civil Engineer/Programmer
Awesome, Thanks! But I am actually trying to open an .exe file, not a .pdf, can your routine be altered to do that?
Hi, For HTM files (command "Browser" "Filespec") should work. For EXE files: + ( startapp "ProgramName" "FiletoEditSpec") -- Laurie Comerford CADApps www.cadapps.com.au ..pdf, can your routine be altered to do that?
To call and execute an .exe I use the following on a menu macro. The same thing can be done within a Lisp program: [Calculator - Converter]^C^C(if (findfile (strcat ec_drv "/ec/miec/convert/convert.exe"))+ (progn (princ)(startapp (strcat ec_drv "/ec/miec/convert/convert.exe"))(princ))) Bob
You did not look at the code, the second function "CT-WINRUN" does exactly that. I did the pdf one because the CT-WINRUN uses explorer.exe to run the file which is slow for pdf's. calpolyarc <> |>Awesome, Thanks! But I am actually trying to open an .exe file, not a .pdf, can your routine be altered to do that? James Maeding Civil Engineer/Programmer
Sorry James... missed it, sometimes my eyes start spinning when I see all that code. Thank you very much, your help is appreciated.