Jump to content

Works from Command Line but not in LISP Program


Bill Tillman

Recommended Posts

(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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

(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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...