Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lisp Help Please

Status
Not open for further replies.

Welshman

Computer
Dec 16, 2002
28
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
 
Replies continue below

Recommended for you

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
 
to do it better you shall close each file and strcat the date and time too


Pardal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor