ASQ Posted September 22, 2023 Posted September 22, 2023 (edited) Hi, im trying to open multiple files at once. I m usind LM script for get the paths, i want save this as a lsp ( a set of dwgs), and then run the lisp that open this set. (defun c:test (/ docslist) (setq docslist (list "C:\\Users\\User\\file01.dwg" "C:\\Users\\User\\file02.dwg" "C:\\Users\\User\\file03.dwg" "C:\\Users\\User\\file04.dwg" ) and im stuck in this part, what can i do for open each file of this list. Command "openfile" ?? Edited September 22, 2023 by ASQ Quote
rlx Posted September 22, 2023 Posted September 22, 2023 (edited) think simplest way would be : (defun c:test ( / docslist) (setq docslist (list "C:\\Users\\User\\file01.dwg" "C:\\Users\\User\\file02.dwg" "C:\\Users\\User\\file03.dwg" "C:\\Users\\User\\file04.dwg" )) (foreach doc docslist (ShellOpen doc)) (princ) ) ; returns T if no errors occurred during program execution (defun ShellOpen ( $f / it sh ) (if (and (not (null $f)) (setq $f (findfile $f)) (setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))) (progn (setq it (vl-catch-all-apply 'vlax-invoke (list sh 'open $f)))(vlax-release-object sh)(not (vl-catch-all-error-p it))) (progn (prompt "\nShell application was unable to open file")(setq it nil)))) Edited September 22, 2023 by rlx replaced void with null 1 Quote
BIGAL Posted September 23, 2023 Posted September 23, 2023 (edited) Ignoring do something on each one. Save as a script file .scr open "C:\\Users\\User\\file01.dwg" open "C:\\Users\\User\\file02.dwg" open "C:\\Users\\User\\file03.dwg" open "C:\\Users\\User\\file04.dwg" Lots of ways to write a script like this, google Lee-Mac script. Edited September 23, 2023 by BIGAL 1 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.