Yes, LIPS is session based, that means you start a command in one drawing, it will run on one drawing and (generally) not run in another.
A few ways round this.
As BigAl says a script can cross drawings, open or create a new drawing, run commands in it.
You could adjust the acad.lsp file, this runs on opening / creating a drawing, but your changes will run on every subsequent drawing
Expanding acad.lsp file idea, you could add the below to acad.lsp file. Will work on EVERY new drawing.
You could create the below as a stand alone LISP file, add it it the startup suit. Will work on EVERY new drawing
You could create a temporary LISP file, search for it and if it exists run it (using acad.lsp or a file in the startup suit)... though of course you'd have to consider deleting after running. Will work on EVERY new drawing till temp file is deleted (can do that with LISP once it is loaded delete the file)
Last one is a bit related, have a list of say, filename prefix and if the file name prefix is in this list do stuff... handy if say a clients drawings are all in the form "12345-dwg-001.dwg", search 123456 and if yes, do stuff. A step further on from the 'if new drawing do stuff' idea above
All depends how your mind works and which you think is the best solution for you.
(defun c:testthis ( / SavedDrawing )
(setq SavedDrawing (getvar "dwgtitled"))
(if (= SavedDrawing 1)
(progn
(alert "Drawing has been saved, is not a new drawing")
) ; end progn
(progn ; savedDrawing = 0
(alert "Drawing has not been saved, is a new drawing")
) ; end progn
) ; end if
(princ)
)
(c:testthis) ;; run on loading