Save dialog box if file not previously

Save dialog box if file not previously

tim.mcc
Contributor Contributor
617 Views
1 Reply
Message 1 of 2

Save dialog box if file not previously

tim.mcc
Contributor
Contributor

I'm not sure if this is possible, but hopefully someone can help.

 

I'm running a LISP that starts by:

- saving the original file

- then SaveAs TEMP.dwg

- program runs

- close TEMP.dwg

- open the original file

 

If the user just opened a template and hasn't saved yet, I would like the Save Dialog Box to pop up for them to specify a save location. If it is already saved, I've been using vla-saveas which has been working well.

 

Is the Save Dialog and option if the file hasn't been saved yet?

 

TIA

 

 

0 Likes
618 Views
1 Reply
Reply (1)
Message 2 of 2

Kent1Cooper
Consultant
Consultant

@tim.mcc wrote:

....

I'm running a LISP that starts by:

- saving the original file

- then SaveAs TEMP.dwg

- program runs

- close TEMP.dwg

- open the original file

 

If the user just opened a template and hasn't saved yet, I would like the Save Dialog Box to pop up for them to specify a save location. If it is already saved, I've been using vla-saveas which has been working well.

 

Is the Save Dialog and option if the file hasn't been saved yet?

....


I suggest you don't use SAVEAS to make a copy to work in and then close that and re-open the source drawing.  I suggest this approach instead:

 

QSAVE the current drawing [if it hasn't been saved yet, the dialog will come up];

Undo Mark [to give you a place to go back to];

Do the "program runs" part;

SAVE to the copy-of-the-drawing file [not SAVEAS, not QSAVE, not any icon that calls itself "SAVE" but really gives you QSAVE];

Undo Back

 

That way you never get out of the drawing to have to get back into it, because SAVE makes an external drawing but leaves you in the current one instead of taking you into the new one as SAVEAS does.

 

An (initdia) function before the QSAVE will bring up the dialog box if the drawing has not yet been saved, but not if it already has.

 

Something like this:

(defun C:WHATEVER ()
  (initdia); to initialize dialog box if not yet saved
  (command "_.qsave")
  (command "_.undo" "_mark")
  ( ... program runs ... )
  (initdia)
  (command "_.save"); to external file, leaving you in current dwg
  (command "_.undo" "_back"); to before "program runs" stuff
)

 

Kent Cooper, AIA
0 Likes