sorry...didn't insert the intire code.
;;; plotlog.lsp
;;; Usage: This routine was designed to keep a log of all plots by writing the
;;; selections to a text file at G:\plotlog.txt. It inserts the following into
;;; the plot log:
;;; Job Number - Paper Used - Sheet Size - Square Feet - Month - Day - Year - Task Number
;;;
;;;
;;; Written By: Craig Boggan
;;; Created: February 12, 2003
;;;
;;; Updated: April 30, 2003
;;; Added task number to job number
;;;
;;; CAD Program(s): AutoCAD 14+
;;;
(defun c:plotlog (/ cmd paper billable cm dm task)
(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
;;;;;;Begin dialog box
(setq dcl_id (load_dialog "plotlog.dcl"))
(if (not (new_dialog "plotlog" dcl_id))
(exit);;if dialog not found..exit
);;end if
(action_tile "no" "(progn(setq dm $key)(activate))")
(action_tile "yes" "(progn(setq dm $key)(go_hpconfig)(activate))")
(action_tile "bond" "(setq paper $key)")
(action_tile "vellum" "(setq paper $key)")
(action_tile "mylar" "(setq paper $key)")
(action_tile "0" "(progn(setq task $key)(deactivate))")
(action_tile "1" "(progn(setq task $key)(deactivate))")
(action_tile "2" "(progn(setq task $key)(deactivate))")
(action_tile "3" "(progn(setq task $key)(deactivate))")
(action_tile "4" "(progn(setq task $key)(deactivate))")
(action_tile "5" "(progn(setq task $key)(deactivate))")
(action_tile "other" "(progn(setq insert_other $key)(activate_other))")
(action_tile "insert" "(setq task $value)")
(action_tile "cancel" "(progn(setq cm $key)(done_dialog))")
(action_tile "ok" "(progn(setq cm $key)(done_dialog))")
(start_dialog)
(unload_dialog dcl_id)
;;;;;;End dialog box
(if (= cm "cancel")
(princ "\nPlotlog aborted by user ")
);;end if
(if (= cm "ok")
(check_newdate2);;if OK is selected on dialog box go to sub-routine check_newdate2
);;end if
(setvar "cmdecho" cmd)
(princ)
);;end defun plotlog
;;-------------------------------------------------------------
;; This checks to make sure the newdate stamp is on the drawing
;; before going any further. If it's not found, the program will
;; end with no errors showing across the command line
;;--------------------------------------------------------------
(defun check_newdate2 (/ find_block)
(setq find_block (ssget "x" '((0 . "INSERT") (2 . "NEWDATE2"))))
(if (= find_block nil)
(alert "\nNewdate block not found...Exiting ")
);;end if
(if (/= find_block nil)
(check_box)
);;end if
);;end defun check_newdate2
(defun go_hpconfig ()
(c:hpconfig)
);;end defun go_hpconfig
;;-------------------------------------------------------------
;; This checks to see which radio buttons were selected on the
;; dialog box and sets the appropriate values
;;--------------------------------------------------------------
(defun check_box ()
(if (= paper "bond")
(progn
(setq paper "Bond")
(start_plotlog)
);;end progn
);;end if
(if (= paper "vellum")
(progn
(setq paper "Vellum")
(start_plotlog)
);;end progn
);;end if
(if (= paper "mylar")
(progn
(setq paper "Mylar")
(start_plotlog)
);;end progn
);;end if
);;end defun check_box
;;---------------------------------------------------------
;; This is section is where the program gathers most of its
;; data and writes it to a plotlog text file
;;---------------------------------------------------------
(defun start_plotlog (/ dwg_name check_date job_number index
fb1 fb2 sheet_size count
sheet_length sheet1 sheet2
square_feet plotlog_line
fil f date1 year
month day date2 time
time1 time2 time3
)
(setq dwg_name (getvar "dwgname"))
(setq check_date (substr dwg_name 1 1));;this finds out if it was in 1999 or 2000+
(if (= check_date "9")
(setq job_number (strcat "9" (substr dwg_name 2 4)));;this creates the job number
);;end if
(if (= check_date "0")
(setq job_number (strcat "2" (substr dwg_name 2 4)));;this creates the job number
);;end if
(setq index 0)
(setq fb1 (entget (ssname find_block index)));;gets first list from block
(setq fb2 (entget(entnext(entnext(entnext(cdr(assoc -1 fb1)))))));;gets sub-list from same block to find sheet size
(setq sheet_size (cdr(assoc 1 fb2)))
;;---------------------------------------------------------
;; This section find the "," between the sheet size numbers
;;---------------------------------------------------------
(setq sf sheet_size
count 1
);end setq
(while
(not
(wcmatch (substr sf count 2) "*`,")
);end not
(setq count (1+ count))
);end while
;;-------------------------
;; End of searching for ","
;;-------------------------
(setq sheet_length (strlen sheet_size));;total length of sheet size extracted
(setq sheet1 (*(atof(substr sheet_size 1 count))));;extracts out first number
(setq sheet2 (atof(substr sheet_size (+ count 2) sheet_length)));;extracts out second number
(setq square_inch (/(* sheet1 sheet2)12));;multiplies two sheet numbers then divides by 12 to get square inch
(if (= paper "Bond")
(setq price (strcat "$"(rtos(* square_inch 0.047)2 2)))
);;end if
(if (= paper "Vellum")
(setq price (strcat "$"(rtos(* square_inch 0.11)2 2)))
);;end if
(if (= paper "Mylar")
(setq price "Unknown")
);;end if
(setq square_feet (rtos(/(* sheet1 sheet2)12)))
(setq sheet_size (strcat (rtos sheet1 2 0)"x"(rtos sheet2 2 0)))
(setq date1 (rtos(getvar "cdate")2 0))
(setq year (substr date1 1 4));; Extracts out the year from the CDATE variable
(setq date1 (substr date1 5 8))
(setq month (substr date1 1 2));; Extracts out the month by number from the CDATE variable
;; Check what month is active at the time of extraction
(if (= month "01")(setq month "January"))
(if (= month "02")(setq month "February"))
(if (= month "03")(setq month "March"))
(if (= month "04")(setq month "April"))
(if (= month "05")(setq month "May"))
(if (= month "06")(setq month "June"))
(if (= month "07")(setq month "July"))
(if (= month "08")(setq month "August"))
(if (= month "09")(setq month "September"))
(if (= month "10")(setq month "October"))
(if (= month "11")(setq month "November"))
(if (= month "12")(setq month "December"))
(setq day (substr date1 3 4));; Extracts out the day from the CDATE variable
(setq time1 (rtos(getvar "cdate")2 4))
(setq time2 (strlen time1))
(setq time3 (substr time1 (- time2 3) time2))
(setq time (strcat(substr time3 1 2)":"(substr time3 3 4)))
(setq job_task_number (strcat job_number "." task))
(setq plotlog_line (strcat job_task_number "," paper "," sheet_size "," square_feet "," month " " day " " year "," time "," price))
(setq fil1 (open "G:\plotlog.txt" "a"))
;(setq fil (getfiled "Select Plot Log file :" "G:\plotlog" "txt" 8))
(if (= fil1 nil)
(progn
(princ "\nPlotlog.txt is missing from H:\ drive ")
(exit)
);;end progn
);;end if
;(setq f (open fil "a"))
(write-line plotlog_line fil1)
(close fil1)
);;end defun start_plotlog
(defun activate ()
(if (/= dm nil);if selected
(progn
(mode_tile "bond" 0);enable
(mode_tile "vellum" 0);enable
(mode_tile "mylar" 0);enable
(mode_tile "0" 0);enable
(mode_tile "1" 0);enable
(mode_tile "2" 0);enable
(mode_tile "3" 0);enable
(mode_tile "4" 0);enable
(mode_tile "5" 0);enable
(mode_tile "other" 0);enable
);;end progn
);;end if
);end activate
(defun activate_other ()
(if (/= insert_other nil);if selected
(progn
(mode_tile "insert" 0);enable
)
(progn
(mode_tile "insert" 1);disable
)
);;end if
);end activate_other
(defun deactivate ()
(mode_tile "insert" 1)
);;end defun deactivate