Jump to content

Easy way to retrieve user profile name?


Lt Dan's legs

Recommended Posts

trying to make a lisp my coworker's and I can use. I'm stuck on user profile name :oops:

 

(defun c:STAMP (/ opt date ent text)
 (initget 1 "Date Name")
 (setq opt (getkword "\nSpecify stamp [Date/Name]: "))
 (while
   (not
     (and
(setq ent (car (entsel "\nSelect text to modify: ")))
(eq "TEXT" (cdr (assoc 0 (setq ent (entget ent)))))
     )
   )
  (prompt "\n**Please select a text to modify!**")
 )
 (if (eq "Date" opt)
   (progn
     (setq date (rtos (getvar "CDATE") 2 0))
     (setq text (strcat (substr date 5 2) "/" (substr date 7 2) "/" (substr date 3 2)))
   )
   [b][color=red](setq text (getvar "???"))[/color][/b]
 )
 (entmod (subst (cons 1 text)(assoc 1 ent) ent))
 (princ)
)

Link to comment
Share on other sites

trying to make a lisp my coworker's and I can use. I'm stuck on user profile name :oops:

 

Wonderful work Lt Dan's legs.

 

Regards.

Edited by Tharwat
Link to comment
Share on other sites

Thanks. If this is useful to anyone here you go

 

(defun c:STAMP (/ *error* opt date ent text)
 (defun *error* (msg)
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **"))
   )
   (princ)
 )
   (initget 1 "Date Name")
   (setq opt (getkword "\nSpecify stamp [Date/Name]: "))
   (while
     (not
       (and
         (setq ent (car (entsel "\nSelect text to modify: ")))
         (setq ent (entget ent))
         (OR
           (eq "TEXT" (cdr (assoc 0 ent)))
           (eq "MTEXT" (cdr (assoc 0 ent)))
         )
       )
     )
    (prompt "\n**Please select a text to modify!**")
   )
   (if (eq "Date" opt)
     (progn
       (setq date (rtos (getvar "CDATE") 2 0))
       (setq text (strcat (substr date 5 2) "/" (substr date 7 2) "/" (substr date 3 2)))
     )
     (setq text (getvar "CPROFILE"))
   )
   (entmod (subst (cons 1 text)(assoc 1 ent) ent))
   (princ)
)

 

Sorry. I only use single line text but decided to allow the use of both... if anyone actually uses this.

Edited by Lt Dan's legs
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...