I would get the filename sans extension using:
Code:
(vl-filename-base (getvar "DWGNAME"))
To paste it into another app could prove a little tricky, from you code I am assuming you are using the Command Line printing routine?
If so then I think you could set a Lisp variable and then use that variable further down you script, like this:
Code:
(setvar "TEXTEVAL" 1)
(setvar "FILEDIA" 0)
(setq dwgname (vl-filename-base (getvar "DWGNAME")))
~your plot routine up to asking for name~
!dwgname
~rest of plot routine, if any~
(setvar "FILEDIA" 1)
(setq dwgname nil)