Bill Tillman Posted September 4, 2012 Share Posted September 4, 2012 (defun c:openvault ();/ fname) (vl-load-com) (setq fname (getfiled "" "//long_novell_path/Folder1/" "dwg" 16)) (vl-file-copy (strcat fname) (strcat "//long_novell_path/Folder2" (substr fname (- (strlen fname) ))) (if (/= fname nil) (setq fname (substr fname (- (strlen fname) )) (vla-activate (vla-open (vla-get-documents (vlax-get-acad-object)) (strcat "//long_novell_path/Folder2/" fname))) ); end if (princ); exit quietly ); end function This is for working with files in a folder which is very restrictive in that the users have very limited rights. Thus all the gyrations here. I ask the user to choose the file they want to open. Make a copy of it in a temporary location, "Folder2" and then attempt to open the drawing from there. Line number seven of the above code will work when I type it on the command line at the console, but it will not work when I run the LISP program. There may be something blantant in this but I'm not understanding why it will not work in my program. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 4, 2012 Share Posted September 4, 2012 Line 7 of your code is the 'else' statement for the if function and will only be evaluated if the variable 'fname' evaluates to nil; however, if 'fname' does evaluate to nil, the vl-file-copy expression would fail in any case. Quote Link to comment Share on other sites More sharing options...
Bill Tillman Posted September 4, 2012 Author Share Posted September 4, 2012 (if (= bill dumba$$) (progn (setq thisline_will work) (command "MTEXT" "But only if he doesn't forget his progn") ); end progn ); end if Darned progn....get me almost everytime. I must have too much on my plate these days. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 4, 2012 Share Posted September 4, 2012 Consider my point however regarding the case in which 'fname' evaluates to nil Quote Link to comment Share on other sites More sharing options...
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.