Results 1 to 4 of 4

Thread: Need help verifying file exists

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Need help verifying file exists

    Could anyone assist me please.
    I am not sure what I am doing wrong ?

    Below is the first part of my routine and not all is relevant. I am stuck with the last part, trying to check if the file already exists to see if I need to replace the file "y" or not.

    Code:
      (setq drawprefix (getvar "dwgprefix"))
      (setq drawname (getvar "dwgname"))
      (setq bldlvl
      (strcase (getstring "\nBuilding Level ie: B1, G, L1 or R? ")
      )
      )
      (setq currentdirectory
      (strcat (getvar "dwgprefix") (getvar "dwgname"))
      )
      (setq newdrawname (strcat "XR-A-" bldlvl))
      (setq num 17)
      (setq strlength (strlen drawprefix))
      (setq newnum (- strlength num))
      (setq ammenddrawprefix1
      (strcat (vl-string-right-trim
         (substr drawprefix newnum strlength)
         drawprefix
       )
       "\\"
      )
      )
      (setq newdirectpath (strcat ammenddrawprefix1 newdrawname))
      (setq check (findfile newdrawname)
      (if (= check newdirctpath) (command "saveas" "r14" newdirectpath "y") (command "saveas" "r14" newdirectpath))
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]

    Would be most great full.
    Seems to work when the "If" options are (princ "\n...) rather the (command "saveas" ...)
    Not sure, Should I be using the "cond" function ?

    regards

    stephen
    Last edited by Opie; 2006-09-18 at 01:22 PM. Reason: [CODE] tags added, see moderator comment

Similar Threads

  1. 2015: FAMILY ALREADY EXISTS
    By gordolake in forum Revit Architecture - General
    Replies: 2
    Last Post: 2014-08-26, 11:29 PM
  2. 2010: error: Unable to load customization file That customization Group already exists
    By aheintze351177 in forum AutoCAD 3D (2007 and above)
    Replies: 0
    Last Post: 2013-01-09, 10:06 PM
  3. Replies: 0
    Last Post: 2011-05-30, 07:07 AM
  4. How to Find a Layer if It Exists?
    By BeKirra in forum AutoLISP
    Replies: 12
    Last Post: 2008-11-06, 01:25 AM
  5. Check to see if file exists
    By ccowgill in forum AutoLISP
    Replies: 11
    Last Post: 2006-04-10, 09:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •