I cant figure out how to check for 2 conditions to be true, then do an action. Can somebody help me out here?
I've got a DCL that asks for PRINTER and SIZE
I want to do something like this:
if PRINTER=PDF.pc3 and SIZE=A then set variable "PSIZE" to "LETTER"
if PRINTER=PDF.pc3 and SIZE=B then set variable "PSIZE" to "TABLOID"
else 'do not change PSIZE'
The variable "PSIZE" is defined higher in the lsp and these would only change it if one of my four printers is the selection.
Thank you.
Dustin
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Gary and Kent,
Let's wait till the OP responds to our latest posts before continuing. It seems apparent to me that his original needs drastically changed in his latest post. Until he can explain exactly how many printers he actually has and how many sheet size choices are really anticipated, all of this guessing and coding is possibly pointless.
Its a lot different to check whether a printer is equal to something than to check is it is not equal to something. This implies a more complex situation of printers and sheet sizes than he originally anticipated.
Gentlemen,
First let me say thank you to everybody that posted, I'll be giving 'Kudos' shortly. Secondly, I'd like to say that it's been enjoyable seeing the camaraderie amongst you all And my apologies for not expressing my needs clearly enough. In the end, I was able to use Henrique's idea. It gives me the ability to easily make a list of all the printer & page size iterations I need, and is therefore expandable to future needs very easily, which is what I was hoping to acheive. I know it's not as elegant as some people would prefer, but a brute force list is reasonable when there's only a handful of iterations - as is the case here. Here's a snippet of the code I ended up using, and I'll attach the full LISP. And in response to people's mention of the laughable state this code was in, I can only say, I agree completely - that's what brought me here! Cheers all, thanks again.
Code: (yes, I realize the first 4 listings are redundant, but it keeps it simple for my feeble mind)
(cond ((and (= PRINTER "Electronic - Bluebeam PDF.pc3") (= PSIZE "Letter")) (setq PSIZE "LETTER") ) ((and (= PRINTER "Electronic - Bluebeam PDF.pc3") (= PSIZE "Tabloid")) (setq PSIZE "TABLOID") ) ((and (= PRINTER "Troy - Printer - Central.pc3") (= PSIZE "Letter")) (setq PSIZE "LETTER") ) ((and (= PRINTER "Troy - Printer - Central.pc3") (= PSIZE "Tabloid")) (setq PSIZE "TABLOID") ) ((and (= PRINTER "Troy - Printer - Repro Room.pc3") (= PSIZE "Letter")) (setq PSIZE "Letter (8.5 x 11\")") ) ((and (= PRINTER "Troy - Printer - Repro Room.pc3") (= PSIZE "Tabloid")) (setq PSIZE "Tabloid (11 x 17\")") ) ((and (= PRINTER "Troy - Printer - West.pc3") (= PSIZE "Letter")) (setq PSIZE "Letter (8.5 x 11\")") ) ((and (= PRINTER "Troy - Printer - West.pc3") (= PSIZE "Tabloid")) (setq PSIZE "Tabloid (11 x 17\")") ) ((and (= PRINTER "Troy - Printer - Southeast.pc3") (= PSIZE "Letter")) (setq PSIZE "Letter (8.5 x 11\")") ) ((and (= PRINTER "Troy - Printer - Southeast.pc3") (= PSIZE "Tabloid")) (setq PSIZE "Tabloid (11 x 17\")") ) );; cond