Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Active Contributor
macuma
Posts: 27
Registered: ‎07-09-2008
Message 1 of 6 (263 Views)
Accepted Solution

Saveas using Lisp Or Vlisp

263 Views, 5 Replies
02-04-2013 05:12 AM

Is it possible to call the saveas command with the dialog showing with the filename already set by a variable?

 

Have already tried (initdia)(command "saveas" "" "MyDrawing") and (initdia)(vl-cmdf "saveas" "" "MyDrawing").

 

If running from a new file the filename in the dialog is always populated as "Drawing1"

Thanks Kent. That does the trick if it can't be done direct from the command.

*Expert Elite*
Kent1Cooper
Posts: 5,540
Registered: ‎09-13-2004
Message 2 of 6 (254 Views)

Re: Saveas using Lisp Or Vlisp

02-04-2013 05:54 AM in reply to: macuma

Look into the (getfiled) function, which has an argument for a default file name.

Kent Cooper
Active Contributor
macuma
Posts: 27
Registered: ‎07-09-2008
Message 3 of 6 (248 Views)

Re: Saveas using Lisp Or Vlisp

02-04-2013 06:11 AM in reply to: Kent1Cooper

Thanks Kent. That does the trick if it can't be done direct from the command.

Active Contributor
macuma
Posts: 27
Registered: ‎07-09-2008
Message 4 of 6 (207 Views)

Re: Saveas using Lisp Or Vlisp

02-20-2013 03:30 AM in reply to: macuma

Only just got round to fully testing this. It accepts the variables but can't be used to save, only to open an existing file.

Active Contributor
macuma
Posts: 27
Registered: ‎07-09-2008
Message 5 of 6 (202 Views)

Re: Saveas using Lisp Or Vlisp

02-20-2013 03:44 AM in reply to: macuma

Sorry, this does work. Didn't read the flag settings correctly.

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 6 of 6 (200 Views)

Re: Saveas using Lisp Or Vlisp

02-20-2013 03:46 AM in reply to: macuma

macuma wrote:

Only just got round to fully testing this. It accepts the variables but can't be used to save, only to open an existing file.


 

(setvar 'expert 5)
(setq fn (getfiled "Save drawing as" (strcat (getvar 'dwgprefix) var) "dwg" 1))
(command "_save" fn)

 

HTH

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.