Jump to content

Settings not applied once run


highrez2

Recommended Posts

Not sure what i have been missing here. But finally decided to do something about our custom code.

 

The lisp looks for a file and if present on system proceeds to step 2.

Step 2 it checks for match with path.

 

this is where i get confused.. I thought a (princ) close's the file clean (no loose ends)

 

however the settings are there (in the options) but not applied.

 

what am I missing? I have looked for some way to apply settings under the options dialog but no success.

(Setvar "cmdecho" 0)

(if (= "24.0s (LMS Tech)" (getvar "ACADVER"))
	(progn
		(if (not (wcmatch (getenv "PrinterConfigDir") "*path*"))									;Looking for Printer Configuration Search Path  
		(setenv "PrinterConfigDir" "path")															;If not found add Printer Configuration Search Path
		)
		(if (not (wcmatch (getenv "PrinterDescDir") "*path*"))					
		(setenv "PrinterDescDir" "path")															;If not found add Printer Description Search Path
		)
		(if (not (wcmatch (getenv "PrinterStyleSheetDir") "*path*"))								;Looking for Path in Plot Style Table Search Path
		(setenv "PrinterStyleSheetDir" "path;")														;If not found add Plot Style Table Search Path
		)
	)
)

;(alert "message")

(Setvar "cmdecho" 1)

(princ)

 

Link to comment
Share on other sites

Hopefully it does not work as this:

(setenv "PrinterConfigDir" "path") 
(setenv "PrinterDescDir" "path")
(setenv "PrinterStyleSheetDir" "path;")	

Is not setting the directory to an actual path. 😬

 

"PATH" most likely needs to be PATH .. post more of your code.

Edited by ronjonp
Link to comment
Share on other sites

18 hours ago, highrez2 said:

If i remove the ; after path everything seams to work now.

 

I was using the Quotes due to spacing in the path name.

I don't understand how that code can work PATH /= "PATH".

 

Graphic to help you understand:

image.png.9821443c9ec0e6021303900d76c1e2d4.png

 

Edited by ronjonp
  • Like 2
Link to comment
Share on other sites

 

;;; Comments list Ver1.0 10-07-15 Inital update

(Setvar "cmdecho" 0)

(if (= "24.0s (LMS Tech)" (getvar "ACADVER"))
	(progn
		(if (not (wcmatch (getenv "PrinterConfigDir") "*K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotters*"))			;Looking for Printer Configuration Search Path  
		(setenv "PrinterConfigDir" "K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotters")									;If not found add Printer Configuration Search Path
		)
		(if (not (wcmatch (getenv "PrinterDescDir") "*K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_PMP*"))					
		(setenv "PrinterDescDir" "K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_PMP")											;If not found add Printer Description Search Path
		)
		(if (not (wcmatch (getenv "PrinterStyleSheetDir") "*K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotstyles*"))		;Looking for Path in Plot Style Table Search Path
		(setenv "PrinterStyleSheetDir" "K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotstyles")							;If not found add Plot Style Table Search Path
		)
	)
)

(Setvar "cmdecho" 1)

(princ)

This should help

Link to comment
Share on other sites

1 hour ago, highrez2 said:

 


;;; Comments list Ver1.0 10-07-15 Inital update

(Setvar "cmdecho" 0)

(if (= "24.0s (LMS Tech)" (getvar "ACADVER"))
	(progn
		(if (not (wcmatch (getenv "PrinterConfigDir") "*K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotters*"))			;Looking for Printer Configuration Search Path  
		(setenv "PrinterConfigDir" "K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotters")									;If not found add Printer Configuration Search Path
		)
		(if (not (wcmatch (getenv "PrinterDescDir") "*K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_PMP*"))					
		(setenv "PrinterDescDir" "K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_PMP")											;If not found add Printer Description Search Path
		)
		(if (not (wcmatch (getenv "PrinterStyleSheetDir") "*K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotstyles*"))		;Looking for Path in Plot Style Table Search Path
		(setenv "PrinterStyleSheetDir" "K:\\Masters\\LOOK HERE\\Another FOLDER\\Company_Plotstyles")							;If not found add Plot Style Table Search Path
		)
	)
)

(Setvar "cmdecho" 1)

(princ)

This should help

Be careful when checking with WCMATCH .. it is case sensitive 😉 .. here's another approach using FOREACH .. not tested.

;;; Comments list Ver1.0 10-07-15 Inital update
;; cmedecho not needed for this code
;; (setvar "cmdecho" 0)
;; Set common path
(setq path "K:\\Masters\\LOOK HERE\\Another FOLDER\\")
(if (= "24.0s (LMS Tech)" (getvar "ACADVER"))
  (foreach dir '(("PrinterConfigDir" "Company_Plotters")
		 (("PrinterDescDir" "Company_PMP"))
		 (("PrinterStyleSheetDir" "Company_Plotstyles"))
		)
    ;; Added strcase for the wcmatch check
    (or	(wcmatch (strcase (getenv (car dir)))
		 (strcat "*" (setq a (strcase (strcat path (cadr dir)))) "*")
	)
	;; Beware this will remove any other paths set .. this what you want?
	(setenv (car dir) a)
    )
  )
  (progn)
)
;; (setvar "cmdecho" 1)
(princ)

 

 

Edited by ronjonp
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...