Auto-Save & Close in One Button

Discussion in 'AutoCAD' started by JRodriguez, Jun 22, 2004.

  1. JRodriguez

    JRodriguez Guest

    OK I'm not sure if this is possible or not, but here goes..... I'm generally looking for a single button to close a drawing without asking me if I want to save or not. I would, of course, like a button for each "yes" & "no" to either save or not save. But I was just thinking about another process within this routine that would be cool. How bout an autosave that occurs just before the whole closing. Be it that I save or don't save. Our network is setup with Autosave folders so my autosave would go there. These folders are deleted every so often so that they don't take up too much space. But if anyone can help me with the idea of creating two buttons, that would be greatly appreciated. One button to autosave and then close without saving and a second button to autosave and then close with saving. Is this possible???

    Thanks in advance for any help,
    JRodriguez
     
    JRodriguez, Jun 22, 2004
    #1
  2. This is close to what you're asking for.

    (defun C:ASC ()
    (setq FolderName "C:/temp/")
    (if (= (getvar "DBMOD") 0)
    (command "close") ;save not required
    (progn
    (if (findfile (setq FileName (strcat FolderName (getvar "DWGNAME"))))
    (command "SAVE" FileName "Y") ;save existing file
    (command "SAVE" FileName) ;save new file
    )
    (command "close")
    )
    )
    (princ)
    )
     
    Alan Henderson @ A'cad Solutions, Jun 23, 2004
    #2
  3. To save a drawing to somewhere else without updating the existing drawing
    file (for "close without saving" purposes), you want the SAVE command (not
    to be confused with QSAVE or SAVEAS), which saves a copy of the current
    state of things to a different place (unless the drawing has not been given
    a file name yet, in which case SAVE & QSAVE & SAVEAS all function the same
    way). Then you can close, and I believe it will not ask whether you want to
    save your changes, because the last thing was a saving type operation.

    To "close with saving," do the SAVE and then a QSAVE, and then close.

    I use these:
    [SaveCont]^C^CQSAVE +
    (command "SAVE" (strcat "<filepath-of-your-autosave-folder>" (getvar
    "DWGNAME"))) Y
    which Saves the drawing in its current location AND to a backup location
    (without closing or ending), including affirming the overwriting of the old
    copy in the backup location (yeah, you get an unknown command message for
    the "Y" if the drawing hasn't been saved to there before, but it doesn't
    affect anything).

    [SaveClose]^C^C-LAYER S 0 ZOOM W (getvar "LIMMIN") (getvar "limmax") +
    QSAVE (command "SAVE" (strcat "<filepath-of-your-autosave-folder>" (getvar
    "DWGNAME"))) +
    Y CLOSE
    which sets the Layer to 0, zooms to the drawing limits, saves locally and
    remotely, affirms the overwrite, and closes the drawing.

    [SaveExit]^C^C-LAYER S 0 ZOOM W (getvar "LIMMIN") (getvar "limmax") +
    QSAVE (command "SAVE" (strcat "<filepath-of-your-autosave-folder>" (getvar
    "DWGNAME"))) +
    QUIT
    which does the same, but gets out of AutoCAD (it will prompt you if there
    are other drawings open).

    Leave the QSAVE out of the second or third for a close-without-saving
    variety.

    Kent Cooper, AIA


    generally looking for a single button to close a drawing without asking me
    if I want to save or not. I would, of course, like a button for each "yes"
    & "no" to either save or not save. But I was just thinking about another
    process within this routine that would be cool. How bout an autosave that
    occurs just before the whole closing. Be it that I save or don't save. Our
    network is setup with Autosave folders so my autosave would go there. These
    folders are deleted every so often so that they don't take up too much
    space. But if anyone can help me with the idea of creating two buttons,
    that would be greatly appreciated. One button to autosave and then close
    without saving and a second button to autosave and then close with saving.
    Is this possible???
     
    Kent Cooper, AIA, Jun 23, 2004
    #3
  4. JRodriguez

    Barr Guest

    And here's yet another way...

    (defun c:sup () ;;; Save to UPdates - my particular folder
    (setq a (getvar "dwgname"))
    (setq b "I:\\updates\\") ;;; Change for your file structure
    (setq c (strcat b a))
    (command "save" c)
    (command "close")
    (princ)
    )



    generally looking for a single button to close a drawing without asking
    me if I want to save or not. I would, of course, like a button for each
    "yes" & "no" to either save or not save. But I was just thinking about
    another process within this routine that would be cool. How bout an
    autosave that occurs just before the whole closing. Be it that I save
    or don't save. Our network is setup with Autosave folders so my
    autosave would go there. These folders are deleted every so often so
    that they don't take up too much space. But if anyone can help me with
    the idea of creating two buttons, that would be greatly appreciated.
    One button to autosave and then close without saving and a second button
    to autosave and then close with saving. Is this possible???
     
    Barr, Jun 23, 2004
    #4
  5. if "dwgname" all ready exists in "I:\\updates\\",
    then (command "save" c) needs to be (command "save" c "Y")
     
    Alan Henderson @ A'cad Solutions, Jun 23, 2004
    #5
  6. JRodriguez

    Barr Guest

    True. And I count on that dialog box popping up to make me think!
     
    Barr, Jun 23, 2004
    #6
  7. JRodriguez

    ECCAD Guest

    My 2 cents,

    (defun auto_save ()
    (setq fil_name (strcat (getvar "filesavepath")(getvar "dwgname")))
    (if (not (findfile (strcat fil_name ".dwg")))
    (command "_saveas" "" fil_name); saveas 'default' version
    ); end if
    (princ)
    ); end function

    Button to autosave and close without saving.
    [AutoSave - NO Dwg save]^c^c(auto_save)(command "_quit" "N");

    Button to autosave and save normal also.
    [AutoSave - Save Dwg also]^c^c(auto_save)(command "_.qsave")(command "_quit" "N");

    Bob
     
    ECCAD, Jun 23, 2004
    #7
  8. JRodriguez

    BTO Guest

    (defun auto_save ()
    (defun c:test ( / )
    (setq File_Name nil )
    (if (= (getvar "dwgtitled") 0)
    (if (setq File_Name (getfiled "Save as" "C:/" "dwg" 1))
    (if (not (findfile File_Name))
    (command "_save" File_Name )
    (command "_save" File_Name "_Y")
    )
    )
    (if (/= (getvar "dbmod") 0) (command "_qsave"))
    )
    (princ)
    )

    Bruno Toniutti
     
    BTO, Jun 23, 2004
    #8
  9. JRodriguez

    ECCAD Guest

    Whoops, added the .dwg on fil_name.
    (defun auto_save ()
    (setq fil_name (strcat (getvar "filesavepath")(getvar "dwgname")))
    (if (not (findfile fil_name))
    (command "_saveas" "" fil_name); first save
    (command "_saveas" "" fil_name "_Y"); next save
    ); end if
    (princ)
    ); end function

    Button to autosave and close without saving.
    [AutoSave - NO Dwg save]^c^c(auto_save)(command "_quit" "N");

    Button to autosave and save normal also.
    [AutoSave - Save Dwg also]^c^c(auto_save)(command "_.qsave")(command "_quit" "N");

    Bob
     
    ECCAD, Jun 23, 2004
    #9
  10. JRodriguez

    JRodriguez Guest

    great

    thanks for the help everyone.. I'm gonna put all of these options to the test and see how they all work. I'll try to kepe everyone informed and let you know how it all turns out.

    Thanks again everyone,
    JRodriguez
     
    JRodriguez, Jun 23, 2004
    #10
  11. JRodriguez

    RaghuMN Guest

    Bob / All,

    We have network version of AutoCAD. Many people simply open a file and spend their time on other softwares, thereby wasting a license.
    Is there any way to AutoSave and Quit AutoCAD from the users who do not use AutoCAD for 45 minutes (any time), without informing them?
    As I have seen, AutoSave needs the activation of AutoCAD software, even after exceeding the time set for auto save.
    Activation could be picking the Drawing icon at the status bar of windows, etc.
    Hence, this AutoSave is not actually AutoSave!!

    Thanks,

    MNRaghu,
     
    RaghuMN, Jun 24, 2004
    #11
  12. Read the License Manager docs. You can timeout a license. You might also
    want to ask this question in the Networking ng, as this isn't really a
    customization question.

    --
    R. Robert Bell


    Bob / All,

    We have network version of AutoCAD. Many people simply open a file and spend
    their time on other softwares, thereby wasting a license.
    Is there any way to AutoSave and Quit AutoCAD from the users who do not use
    AutoCAD for 45 minutes (any time), without informing them?
    As I have seen, AutoSave needs the activation of AutoCAD software, even
    after exceeding the time set for auto save.
    Activation could be picking the Drawing icon at the status bar of windows,
    etc.
    Hence, this AutoSave is not actually AutoSave!!

    Thanks,

    MNRaghu,
     
    R. Robert Bell, Jun 24, 2004
    #12
  13. JRodriguez

    ECCAD Guest

    As I have seen, AutoSave needs the activation of AutoCAD software, even after exceeding the time set for auto save.<<
    If you don't have AutoCAD running - wadaya gonna save ?
    8:(
    Bob
     
    ECCAD, Jun 24, 2004
    #13
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.