ok now i got the dialogue running and the lisp file working in order...maybenot any error checking but it does the job...what ya think?
the lisp file
;;Wynn Engineering Inc.
;;plog.LSP file CREATED BY SOUK
;;souksavanh nomichith
;;www.cadtechnic.theswamp.org
;;last update 05-04-05
;;last update 05-25-05
;;;integrated plog dialogue
;AUTOLISP CODING STARTS HERE
(prompt "\nType PLOG to run plot logging.....")
;;;thanks to www.theswamp.org
;;;getting the date function provided by www.afralisp.com
;;;
(defun today( / d yr mo day)
;define the function and declare all variabled local
(setq d (rtos (getvar "CDATE") 2 6)
;get the date and time and convert to text
yr (substr d 3 2)
;extract the year
mo (substr d 5 2)
;extract the month
day (substr d 7 2)
;extract the day
);setq
(strcat mo "/" day "/" yr)
;string 'em together
)
;;end of date function
;;
(defun C:plog ( / dcl_id usern bill jn jna thedate ssize paper numplot file_open)
;;setting up data for the log
(setq thedate (today))
(setq userN (getvar "loginname"))
(setq jn (getvar "dwgname"))
(substr jn 1 (- (strlen jn) 4))
;;shortening the dwgname by 4 characters
;;load the dialog here
;;;
(setq dcl_id (load_dialog "plog.dcl"))
(if (not (new_dialog "plog" dcl_id))
(exit )
);if
;;callbacks for dialogs
;;
(set_tile "JNa" "Enter job name here")
(mode_tile "JNa" 2)
(action_tile "JNa" "(setq JNa $value)")
(action_tile "NumPlot" "(setq NumPlot $value)")
(action_tile "accept" "(val1)")
;;paper grade callbacks
(action_tile "bond" "(setq paper $key)")
(action_tile "vellum" "(setq paper $key)")
(action_tile "mylar" "(setq paper $key)")
;;paper size callbacks
(action_tile "24x36" "(setq ssize $key)")
(action_tile "12x18" "(setq ssize $key)")
(action_tile "30x42" "(setq ssize $key)")
(action_tile "21x15" "(setq ssize $key)")
(action_tile "11x17" "(setq ssize $key)")
(action_tile "8.5x11" "(setq ssize $key)")
;;billing section callbacks
(action_tile "Billed" "(setq bill $key)")
(action_tile "Not-Billed" "(setq bill $key)")
(start_dialog)
(unload_dialog dcl_id)
;;end of dialogue and unloading
;;;
;;gathered information to print into pop-up alert
;;message to confirm the collected information
(alert (strcat "The project " JNa " has been plotted " "on " ssize " " paper " " bill " " NumPlot " time(s) by " usern ))
(princ)
);defun
-----------------------;;job name error checking
(defun val1 ()
(if (= (get_tile "JNa") "Enter Job Name Here")
(progn
(set_tile "error" "You must enter a job name!")
(mode_tile "JNa" 2)
);progn
(val2)
);if
);defun
-------------------;;number of plots error checking
(defun val2 ()
(if (< (atoi (get_tile "NumPlot")) 1)
(progn
(set_tile "error" "Invalid number - Please Try Again!!")
(mode_tile "NumPlot" 2)
);progn
(done_dialog)
)
(setq stringoutput (strcat thedate "," jn "," jna "," ssize "," userN "," bill "," numplot "," ))
;;end of collected information
;;start of editing output text
(setq file_open (open "S:\\Plog\\plotterlog.CSV" "a"))
(write-line stringoutput file_open)
(close file_open)
;;end of output text
(princ)
);;end defun
the dcl file
//Wynn Engineering Inc.
//plog.LSP file CREATED BY SOUK
//souksavanh nomichith
//last update 05-25-05
//plot log dcl file needed to run plog
plog
: dialog
{
label = "Wynn Engineering PlotLog";
//job name
: edit_box
{
label = "Enter the job name :";
mnemonic = "N";
key = "JNa";
alignment = centered;
edit_limit = 30;
edit_width = 30;
}
: edit_box
{
//number of plots
label = "Enter the number of plots :";
mnemonic = "A";
key = "NumPlot";
alignment = centered;
edit_limit = 3;
edit_width = 3;
value = "";
}
//paper grade
: boxed_radio_row {
label = "Select Paper Grade";
mnemonic = "S";
: radio_button {
label = "Bond";
mnemonic = "B";
key = "bond";
}
: radio_button {
label = "Vellum";
mnemonic = "V";
key = "vellum";
}
: radio_button {
label = "Mylar";
mnemonic = "M";
key = "mylar";
}
}
//sheet sizes
: boxed_radio_row {
label = "Select sheet size";
mnemonic = "ss";
:radio_button {
label = "24x36";
mnemonic = "D";
key = "24x36";
}
:radio_button {
label = "12x18";
mnemonic = "D";
key = "12x18";
}
:radio_button {
label = "30x42";
mnemonic = "D";
key = "30x42";
}
:radio_button {
label = "21x15";
mnemonic = "D";
key = "21x15";
}
:radio_button {
label = "11x17";
mnemonic = "D";
key = "11x17";
}
:radio_button {
label = "8.5x11";
mnemonic = "D";
key = "8.5x11";
}
}
//billing section
: boxed_radio_row {
label = "Select billing";
mnemonic = "b";
:radio_button {
label = "Billable";
mnemonic = "D";
key = "Billed";
}
:radio_button {
label = "Non-Billable";
mnemonic = "D";
key = "Not-Billed";
}
}ok_cancel;
}
//DCL CODING ENDS HERE