×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Lisp Help Please

Lisp Help Please

Lisp Help Please

(OP)
I am trying to devise a LISP routine that, when starting a new drawing the routine will look at the system variables "DWGNAME" and "LOGINNAME", collate the two resultant strings together and then write a blank file(zero bytes)with the name of the empty file being the joined "DWGNAME"+"LOGINNAME". The purpose of this is to monitor which drawings were opened, or created, when and by whom.

I will save this LISP routine to the ACADDOC.LSP on each PC.

Below is as far as I have got, but initially I am having two problems.

1. How do I create one STRING for the file name from the "DWGNAME" & "LOGINNAME" chars.

2. What is the best way to write a blank file to a specific directory.  i was thinking of useing the old DOS command COPY CON "filename"  ctrl Z.

My code so far:

(setvar "cmdecho" 0)
(setq fname ((getvar "dwgname")+(getvar "Loginname")))
(command "copy con" fname)

Please forgive my simplistic routine, still new into this LISP lark.

Any help would be gratefully received.

The WelshMan

RE: Lisp Help Please

(OP)
its ok guys I've sussed it:

(setq file (strcat "o:/plot/drawings/" (getvar"loginname") (getvar"dwgname")))

(setq a (open file "w"))

This now creates a new file of zero bytes with the filename made up from the user name and the drawing name every time someone goes into a drawings .  These file names are stored in my network drive O:\plos\drawings

Its handy to keep an eye on what everyone is doing.

Regards - The Welshman

RE: Lisp Help Please

to do it better you shall close each file and strcat the date and time too

Pardal

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources